Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add user profile tests #1119

Merged
merged 19 commits into from
Aug 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update test_user_api.py
  • Loading branch information
michplunkett committed Aug 2, 2024
commit e3250e1503d377ffc3d438cd3b7804d8eb1da6e7
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
Loading