Add event tests to document comments app

Switch view to return an HTTP 404 on lack of authorization
instead of an HTTP 403.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2018-12-30 16:05:37 -04:00
parent 45ceab024d
commit ffeb580c15
8 changed files with 161 additions and 91 deletions

View File

@@ -8,20 +8,14 @@ from ..permissions import (
)
from .literals import TEST_COMMENT_TEXT
from .mixins import CommentsTestMixin
class CommentsViewsTestCase(GenericDocumentViewTestCase):
class CommentsViewsTestCase(CommentsTestMixin, GenericDocumentViewTestCase):
def setUp(self):
super(CommentsViewsTestCase, self).setUp()
self.login_user()
def _request_document_comment_add_view(self):
return self.post(
viewname='comments:comment_add',
kwargs={'document_pk': self.document.pk},
data={'comment': TEST_COMMENT_TEXT}
)
def test_document_comment_add_view_no_permission(self):
response = self._request_document_comment_add_view()
self.assertEqual(response.status_code, 404)
@@ -40,12 +34,6 @@ class CommentsViewsTestCase(GenericDocumentViewTestCase):
user=self.user, comment=TEST_COMMENT_TEXT
)
def _request_document_comment_delete_view(self):
return self.post(
viewname='comments:comment_delete',
kwargs={'comment_pk': self.test_comment.pk},
)
def test_document_comment_delete_view_no_permission(self):
self._create_test_comment()