From a7565342c047fa44a475172edf9af02a02ee5d0b Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Fri, 6 Nov 2020 10:49:24 +0100 Subject: [PATCH] Add test for appending slashes to URLs in the right situations --- src/tests/api/test_append_slash.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/tests/api/test_append_slash.py diff --git a/src/tests/api/test_append_slash.py b/src/tests/api/test_append_slash.py new file mode 100644 index 000000000..544a3ffdf --- /dev/null +++ b/src/tests/api/test_append_slash.py @@ -0,0 +1,14 @@ +import pytest + + +@pytest.mark.django_db +def test_get(token_client, organizer, event, team): + resp = token_client.get('/api/v1/organizers/{}/teams'.format(organizer.slug), follow=False) + assert resp.status_code == 301 + assert resp['Location'].endswith('/') + + +@pytest.mark.django_db +def test_post(token_client, organizer, event, team): + resp = token_client.post('/api/v1/organizers/{}/teams'.format(organizer.slug), follow=False) + assert resp.status_code == 404