Skip to content

Commit 105dbd1

Browse files
committed
🚨(backend) replace 401 status by 403 in tests
By introducing an other authentication class the status code has changed from 401 to 403. All new code added since june must be updated.
1 parent 2b92055 commit 105dbd1

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/backend/core/tests/items/test_api_items_search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def test_api_items_search_anonymous():
1414
"""Anonymous users should not be able to search for items."""
1515
client = APIClient()
1616
response = client.get("/api/v1.0/items/search/")
17-
assert response.status_code == 401
17+
assert response.status_code == 403
1818

1919

2020
def test_api_items_search_authenticated_without_filters():

src/backend/core/tests/items/test_api_items_trashbin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_api_items_trashbin_anonymous(reach, role):
2929

3030
response = APIClient().get("/api/v1.0/items/trashbin/")
3131

32-
assert response.status_code == 401
32+
assert response.status_code == 403
3333

3434

3535
def test_api_items_trashbin_format(settings):

src/backend/core/tests/items/test_api_items_wopi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def test_api_items_wopi_anonymous_user_item_not_public(link_reach):
9595
client = APIClient()
9696
response = client.get(f"/api/v1.0/items/{item.id!s}/wopi/")
9797

98-
assert response.status_code == 401
98+
assert response.status_code == 403
9999

100100

101101
def test_api_items_wopi_anonymous_user_not_item_file():

src/backend/core/tests/test_api_sdk_relay.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_api_sdk_relay_register_event_anonymous():
2828
{"token": "1Az6SO4CE7JAl9hE96dXl7145nghwZNP", "event": {"type": "test"}},
2929
format="json",
3030
)
31-
assert response.status_code == 401
31+
assert response.status_code == 403
3232

3333

3434
def test_api_sdk_relay_register_event():

src/backend/e2e/tests/test_api_e2e.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_api_e2e_user_auth_anonymous():
3737
client = APIClient()
3838

3939
response = client.get("/api/v1.0/users/me/")
40-
assert response.status_code == 401
40+
assert response.status_code == 403
4141

4242
response = client.post("/api/v1.0/e2e/user-auth/", {"email": "[email protected]"})
4343
assert response.status_code == 200
@@ -55,7 +55,7 @@ def test_api_e2e_user_auth_authenticated():
5555
client = APIClient()
5656

5757
response = client.get("/api/v1.0/users/me/")
58-
assert response.status_code == 401
58+
assert response.status_code == 403
5959

6060
response = client.post("/api/v1.0/e2e/user-auth/", {"email": "[email protected]"})
6161
assert response.status_code == 200
@@ -81,7 +81,7 @@ def test_api_e2e_user_auth_email_required():
8181
client = APIClient()
8282

8383
response = client.get("/api/v1.0/users/me/")
84-
assert response.status_code == 401
84+
assert response.status_code == 403
8585

8686
response = client.post("/api/v1.0/e2e/user-auth/", {})
8787
assert response.status_code == 400

0 commit comments

Comments
 (0)