Skip to content

Commit

Permalink
Test additional cases
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Jul 5, 2024
1 parent 2f084aa commit b03267c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions projects/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ def test_smoke(self):
'<input type="hidden" name="msgid_1" value="Copied code!" id="id_msgid_1">',
)

r = su_client.get(
c.get_absolute_url() + "?start=1000", headers={"accept-language": "en"}
)
self.assertContains(r, "msgid_0")
self.assertContains(
r,
'<input type="hidden" name="msgid_1" value="Copied code!" id="id_msgid_1">',
)

r = su_client.get(
c.get_absolute_url() + "?pending=on", headers={"accept-language": "en"}
)
Expand All @@ -87,12 +96,24 @@ def test_smoke(self):
self.assertRedirects(r, c.get_absolute_url())

# API test
r = su_client.get(
"/api/pofile/test/fr/djangojs/",
headers={"x-cli-version": "anything"},
)
self.assertEqual(r.status_code, 400)

r = su_client.get(
"/api/pofile/test/fr/djangojs/",
headers={"x-cli-version": settings.CLI_VERSION},
)
self.assertEqual(r.status_code, 403)

r = su_client.get(
"/api/pofile/not-exists/fr/djangojs/",
headers={"x-token": superuser.token, "x-cli-version": settings.CLI_VERSION},
)
self.assertEqual(r.status_code, 404)

r = su_client.get(
"/api/pofile/test/fr/djangojs/",
headers={"x-token": superuser.token, "x-cli-version": settings.CLI_VERSION},
Expand Down

0 comments on commit b03267c

Please sign in to comment.