diff options
author | 2022-01-31 22:52:08 +0100 | |
---|---|---|
committer | 2022-01-31 22:52:08 +0100 | |
commit | 47248a0a1e183871879ad1506b08a19a0b2042f4 (patch) | |
tree | a07b8979b38d8c9ff71b81df3af7ff2dda73d84f | |
parent | Revert changes to pyproject.toml. (diff) |
Add more tests for the new resources page.
Coverage is now 100%.
-rw-r--r-- | pydis_site/apps/resources/tests/test_views.py | 12 | ||||
-rw-r--r-- | pyproject.toml | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/pydis_site/apps/resources/tests/test_views.py b/pydis_site/apps/resources/tests/test_views.py index 0af5ce5f..a2a203ce 100644 --- a/pydis_site/apps/resources/tests/test_views.py +++ b/pydis_site/apps/resources/tests/test_views.py @@ -15,3 +15,15 @@ class TestResourcesView(TestCase): url = reverse("resources:index") response = self.client.get(url) self.assertEqual(response.status_code, 200) + + def test_resources_with_valid_argument(self): + """Check that you can resolve the resources when passing a valid argument.""" + url = reverse("resources:index", kwargs={"resource_type": "book"}) + response = self.client.get(url) + self.assertEqual(response.status_code, 200) + + def test_resources_with_invalid_argument(self): + """Check that you can resolve the resources when passing an invalid argument.""" + url = reverse("resources:index", kwargs={"resource_type": "urinal-cake"}) + response = self.client.get(url) + self.assertEqual(response.status_code, 404) diff --git a/pyproject.toml b/pyproject.toml index 6392f871..b350836e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,6 +51,7 @@ start = "python manage.py run --debug" makemigrations = "python manage.py makemigrations" django_shell = "python manage.py shell" test = "coverage run manage.py test" +coverage = "coverage run manage.py test --no-input; coverage report -m" report = "coverage report -m" lint = "pre-commit run --all-files" precommit = "pre-commit install" |