Files
mayan-edms/mayan/apps/smart_settings/tests/test_view_permissions.py
Roberto Rosario f9eb7d0fb5 Renamed the document type permission namespace from "Document setup" to "Document types".
Add support for granting the document type edit, document type delete, and document type view
permissions to individual document type instances.
Improved tests by testing for accesses.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2017-07-17 20:41:11 -04:00

33 lines
1010 B
Python

from __future__ import absolute_import, unicode_literals
from common.tests.test_views import GenericViewTestCase
from ..permissions import permission_settings_view
class SmartSettingViewPermissionsTestCase(GenericViewTestCase):
def setUp(self):
super(SmartSettingViewPermissionsTestCase, self).setUp()
self.login_user()
def test_view_access_denied(self):
response = self.get('settings:namespace_list')
self.assertEqual(response.status_code, 403)
response = self.get(
'settings:namespace_detail', args=('common',)
)
self.assertEqual(response.status_code, 403)
def test_view_access_permitted(self):
self.grant_permission(permission=permission_settings_view)
response = self.get('settings:namespace_list')
self.assertEqual(response.status_code, 200)
response = self.get(
'settings:namespace_detail', args=('common',)
)
self.assertEqual(response.status_code, 200)