Files
mayan-edms/mayan/apps/mayan_statistics/tests/test_views.py
Roberto Rosario 8e69178e07 Project: Switch to full app paths
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>
2018-12-05 02:04:20 -04:00

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)