Skip to content

Commit 386da0e

Browse files
committed
Change HTTP return code to 404 in some tests
1 parent 9e17c09 commit 386da0e

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

src/api/controllers/userController.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def update_user_link(user_id, link_id):
311311
link = UserLink.query.filter_by(user_id=user_id, id=link_id).first()
312312

313313
if link == None:
314-
return "Failed to update user link.", 404
314+
return "", 404
315315

316316
for key, value in request.get_json().items():
317317
if not hasattr(link, key):

tests/api/views/test_projectView.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ def test_update_project(self, client):
2424

2525
# project id doesn't exist
2626
response = client.put('/projects/0', json={'name': 'Updated PB'})
27-
28-
# notice: should return 404 when doesen't exist insted of 400
2927
assert response.status_code == 404
3028

3129
project_id = create_project_for_test_cases(self.valid_data)

tests/api/views/test_userView.py

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

2727
response = client.put('/users/1', json={})
28-
assert response.status_code == 400
28+
assert response.status_code == 404
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={})
@@ -107,7 +107,7 @@ def test_update_user_link(self, client):
107107
url = "/users/{0}/links/{1}".format(0, link["id"])
108108

109109
response = client.put(url, json={"name": "Portfolio"})
110-
assert response.status_code == 400
110+
assert response.status_code == 404
111111

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

0 commit comments

Comments
 (0)