mirror of
https://github.com/bellingcat/auto-archiver-api.git
synced 2026-06-11 04:58:33 +03:00
fixing test with new test files
This commit is contained in:
@@ -24,10 +24,11 @@ def test_endpoint_home_with_groups(m1, m2, m3, client_with_auth):
|
||||
assert "groups" in j
|
||||
assert j["groups"] == ["group1", "group2"]
|
||||
|
||||
|
||||
@patch("endpoints.default.bearer_security", new_callable=AsyncMock)
|
||||
@patch("endpoints.default.get_user_auth", new_callable=AsyncMock, return_value="test@example.com")
|
||||
@patch("endpoints.default.crud.get_user_groups", side_effect=Exception('mocked error'))
|
||||
def test_endpoint_home_with_groups_exception(m1, m2, m3, client_with_auth): # mocks call that triggers an internal error
|
||||
def test_endpoint_home_with_groups_exception(m1, m2, m3, client_with_auth): # mocks call that triggers an internal error
|
||||
r = client_with_auth.get("/")
|
||||
assert r.status_code == 200
|
||||
j = r.json()
|
||||
@@ -47,10 +48,12 @@ def test_endpoint_groups_403(client):
|
||||
assert r.status_code == 403
|
||||
|
||||
|
||||
def test_endpoint_groups_empty(client_with_auth):
|
||||
def test_endpoint_groups_rick_and_morty(client_with_auth):
|
||||
r = client_with_auth.get("/groups")
|
||||
assert r.status_code == 200
|
||||
assert r.json() == []
|
||||
assert len(j := r.json()) == 2
|
||||
assert 'animated-characters' in j
|
||||
assert 'spaceship' in j
|
||||
|
||||
|
||||
@patch("endpoints.default.crud.get_user_groups", return_value=["group1", "group2"])
|
||||
|
||||
Reference in New Issue
Block a user