Skip to content

Commit 47248a0

Browse files
committed
Add more tests for the new resources page.
Coverage is now 100%.
1 parent 71b1e7e commit 47248a0

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

pydis_site/apps/resources/tests/test_views.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,15 @@ def test_resources_index_200(self):
1515
url = reverse("resources:index")
1616
response = self.client.get(url)
1717
self.assertEqual(response.status_code, 200)
18+
19+
def test_resources_with_valid_argument(self):
20+
"""Check that you can resolve the resources when passing a valid argument."""
21+
url = reverse("resources:index", kwargs={"resource_type": "book"})
22+
response = self.client.get(url)
23+
self.assertEqual(response.status_code, 200)
24+
25+
def test_resources_with_invalid_argument(self):
26+
"""Check that you can resolve the resources when passing an invalid argument."""
27+
url = reverse("resources:index", kwargs={"resource_type": "urinal-cake"})
28+
response = self.client.get(url)
29+
self.assertEqual(response.status_code, 404)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ start = "python manage.py run --debug"
5151
makemigrations = "python manage.py makemigrations"
5252
django_shell = "python manage.py shell"
5353
test = "coverage run manage.py test"
54+
coverage = "coverage run manage.py test --no-input; coverage report -m"
5455
report = "coverage report -m"
5556
lint = "pre-commit run --all-files"
5657
precommit = "pre-commit install"

0 commit comments

Comments
 (0)