Skip to content

Commit

Permalink
Update test_user_api.py
Browse files Browse the repository at this point in the history
  • Loading branch information
michplunkett committed Aug 2, 2024
1 parent 23848ec commit e3250e1
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions OpenOversight/tests/routes/test_user_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,24 @@ def test_user_api_login_required(route, methods, client, mockdata):
def test_user_cannot_access_user_api(route, methods, mockdata, client, session):
with current_app.test_request_context():
login_user(client)
if HTTPMethod.GET in methods:
rv = client.get(route)
assert rv.status_code == HTTPStatus.FORBIDDEN
if HTTPMethod.POST in methods:
rv = client.post(route)
assert rv.status_code == HTTPStatus.FORBIDDEN
if HTTPMethod.GET in methods:
rv = client.get(route)
assert rv.status_code == HTTPStatus.FORBIDDEN
if HTTPMethod.POST in methods:
rv = client.post(route)
assert rv.status_code == HTTPStatus.FORBIDDEN


@pytest.mark.parametrize("route,methods", routes_methods)
def test_ac_cannot_access_user_api(route, methods, mockdata, client, session):
with current_app.test_request_context():
login_ac(client)
if HTTPMethod.GET in methods:
rv = client.get(route)
assert rv.status_code == HTTPStatus.FORBIDDEN
if HTTPMethod.POST in methods:
rv = client.post(route)
assert rv.status_code == HTTPStatus.FORBIDDEN
if HTTPMethod.GET in methods:
rv = client.get(route)
assert rv.status_code == HTTPStatus.FORBIDDEN
if HTTPMethod.POST in methods:
rv = client.post(route)
assert rv.status_code == HTTPStatus.FORBIDDEN


def test_admin_can_update_users_to_ac(mockdata, client, session):
Expand Down

0 comments on commit e3250e1

Please sign in to comment.