aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--patchwork/tests/test_detail.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/patchwork/tests/test_detail.py b/patchwork/tests/test_detail.py
index 32fbfaf..92fe2d7 100644
--- a/patchwork/tests/test_detail.py
+++ b/patchwork/tests/test_detail.py
@@ -9,6 +9,7 @@ from django.urls import reverse
from patchwork.tests.utils import create_comment
from patchwork.tests.utils import create_cover
from patchwork.tests.utils import create_patch
+from patchwork.tests.utils import create_project
class CoverLetterViewTest(TestCase):
@@ -50,6 +51,23 @@ class CoverLetterViewTest(TestCase):
response = self.client.get(requested_url)
self.assertRedirects(response, redirect_url)
+ def test_invalid_project_id(self):
+ requested_url = reverse(
+ 'cover-detail',
+ kwargs={'project_id': 'foo', 'msgid': 'bar'},
+ )
+ response = self.client.get(requested_url)
+ self.assertEqual(response.status_code, 404)
+
+ def test_invalid_cover_id(self):
+ project = create_project()
+ requested_url = reverse(
+ 'cover-detail',
+ kwargs={'project_id': project.linkname, 'msgid': 'foo'},
+ )
+ response = self.client.get(requested_url)
+ self.assertEqual(response.status_code, 404)
+
class PatchViewTest(TestCase):
@@ -121,6 +139,23 @@ class PatchViewTest(TestCase):
response = self.client.get(requested_url)
self.assertNotIn('<b>TEST</b>'.encode('utf-8'), response.content)
+ def test_invalid_project_id(self):
+ requested_url = reverse(
+ 'patch-detail',
+ kwargs={'project_id': 'foo', 'msgid': 'bar'},
+ )
+ response = self.client.get(requested_url)
+ self.assertEqual(response.status_code, 404)
+
+ def test_invalid_patch_id(self):
+ project = create_project()
+ requested_url = reverse(
+ 'patch-detail',
+ kwargs={'project_id': project.linkname, 'msgid': 'foo'},
+ )
+ response = self.client.get(requested_url)
+ self.assertEqual(response.status_code, 404)
+
class CommentRedirectTest(TestCase):