Skip to content

Commit

Permalink
add test for browsable API
Browse files Browse the repository at this point in the history
  • Loading branch information
felixrindt committed Jul 19, 2023
1 parent 0efb8df commit 2484753
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/api/test_event_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ def test_api_event_list_rejects_anonymous_get(django_app, event):
assert "Authentication credentials were not provided." in response


def test_browseable_api_renders(django_app, event, planner):
response = django_app.get(
reverse("api:event-list"),
user=planner,
status=200,
headers={"Accept": "text/html"},
)
# logged in user only shown in browseable api
assert str(planner) in response.text


def test_api_event_list_view_permission_checks(django_app, event, planner, groups, volunteer):
django_app.get(
reverse("api:event-detail", kwargs=dict(pk=event.pk)), user=volunteer, status=200
Expand Down

0 comments on commit 2484753

Please sign in to comment.