Instead of inserting the path of the apps into the Python app, the apps are now referenced by their full import path. This app name claves with external or native Python libraries. Example: Mayan statistics app vs. Python new statistics library. Every app reference is now prepended with 'mayan.apps'. Existing config.yml files need to be updated manually. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
49 lines
1.3 KiB
Python
49 lines
1.3 KiB
Python
from __future__ import unicode_literals
|
|
|
|
from mayan.apps.common.tests import GenericViewTestCase
|
|
|
|
from ..classes import Statistic
|
|
from ..permissions import permission_statistics_view
|
|
|
|
|
|
class StatisticsViewTestCase(GenericViewTestCase):
|
|
def test_statistic_detail_view_no_permissions(self):
|
|
self.login_user()
|
|
|
|
statistic = Statistic.get_all()[0]
|
|
|
|
response = self.get(
|
|
'statistics:statistic_detail', args=(statistic.slug,)
|
|
)
|
|
|
|
self.assertEqual(response.status_code, 403)
|
|
|
|
def test_statistic_detail_view_with_permissions(self):
|
|
self.login_user()
|
|
|
|
self.grant_permission(permission=permission_statistics_view)
|
|
|
|
statistic = Statistic.get_all()[0]
|
|
|
|
response = self.get(
|
|
'statistics:statistic_detail', args=(statistic.slug,)
|
|
)
|
|
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
def test_statistic_namespace_list_view_no_permissions(self):
|
|
self.login_user()
|
|
|
|
response = self.get('statistics:namespace_list')
|
|
|
|
self.assertEqual(response.status_code, 403)
|
|
|
|
def test_statistic_namespace_list_view_with_permissions(self):
|
|
self.login_user()
|
|
|
|
self.grant_permission(permission=permission_statistics_view)
|
|
|
|
response = self.get('statistics:namespace_list')
|
|
|
|
self.assertEqual(response.status_code, 200)
|