Skip to content

Commit 9e17c09

Browse files
committed
Change update method to PUT in tests
1 parent 5c68f56 commit 9e17c09

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

tests/api/views/test_projectView.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_create_project(self, client):
2323
def test_update_project(self, client):
2424

2525
# project id doesn't exist
26-
response = client.post('/projects/0', json={'name': 'Updated PB'})
26+
response = client.put('/projects/0', json={'name': 'Updated PB'})
2727

2828
# notice: should return 404 when doesen't exist insted of 400
2929
assert response.status_code == 404
@@ -94,7 +94,7 @@ def test_update_project_link(self, client):
9494
# response = client.post(url.format(0, p1_link["id"]))
9595
# assert response.status_code == 404
9696

97-
response = client.post(url.format(p1["id"], p1_link["id"]), json={"name": "Nlink"})
97+
response = client.put(url.format(p1["id"], p1_link["id"]), json={"name": "Nlink"})
9898
assert response.status_code == 200
9999
assert response.get_json()["name"] == "Nlink"
100100

tests/api/views/test_userView.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ def test_create_user(self, client):
2424
def test_update_user(self, client):
2525
user_id = create_user_for_test_cases(self.valid_data)["id"]
2626

27-
response = client.post('/users/1', json={})
27+
response = client.put('/users/1', json={})
2828
assert response.status_code == 400
2929

3030
# notice: Should we respond to update_user request without json data with status code 200?
3131
# response = client.post('/users/{}'.format(user_id), json={})
3232
# assert response.status_code == 400
3333

34-
response = client.post('/users/{}'.format(user_id), json={"name": "Updated Name"})
34+
response = client.put('/users/{}'.format(user_id), json={"name": "Updated Name"})
3535
assert response.status_code == 200
3636

3737
assert response.get_json()['name'] == "Updated Name"
@@ -106,22 +106,22 @@ def test_update_user_link(self, client):
106106

107107
url = "/users/{0}/links/{1}".format(0, link["id"])
108108

109-
response = client.post(url, json={"name": "Portfolio"})
109+
response = client.put(url, json={"name": "Portfolio"})
110110
assert response.status_code == 400
111111

112112
url = "/users/{0}/links/{1}".format(user["id"], link["id"])
113113

114-
response = client.post(url, json={"user_id": 0})
114+
response = client.put(url, json={"user_id": 0})
115115
assert response.status_code == 400
116116

117-
response = client.post(url, json={"link_id": 1})
117+
response = client.put(url, json={"link_id": 1})
118118
assert response.status_code == 400
119119

120120
# notice: Should we respond to update_user request without json data with status code 200?
121121
# response = client.post(url, json={})
122122
# assert response.status_code == 400
123123

124-
response = client.post(url, json={"name": "New Name"})
124+
response = client.put(url, json={"name": "New Name"})
125125
assert response.status_code == 200
126126
assert response.get_json()["name"] == "New Name"
127127

0 commit comments

Comments
 (0)