Instead of inserting the path of the apps into the Python app, the apps are now referenced by their full import path. This solves name clashes 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>
30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
from __future__ import unicode_literals
|
|
|
|
from mayan.apps.documents.tests import GenericDocumentViewTestCase
|
|
from mayan.apps.documents.permissions import permission_document_create
|
|
|
|
from ..links import link_document_create_multiple
|
|
|
|
|
|
class SourcesLinksTestCase(GenericDocumentViewTestCase):
|
|
def setUp(self):
|
|
super(SourcesLinksTestCase, self).setUp()
|
|
self.login_user()
|
|
|
|
def _get_document_create_link(self):
|
|
self.add_test_view(test_object=self.document)
|
|
context = self.get_test_view()
|
|
context['user'] = self.user
|
|
return link_document_create_multiple.resolve(context=context)
|
|
|
|
def test_document_create_link_no_access(self):
|
|
resolved_link = self._get_document_create_link()
|
|
self.assertEqual(resolved_link, None)
|
|
|
|
def test_document_create_link_with_access(self):
|
|
self.grant_access(
|
|
permission=permission_document_create, obj=self.document_type
|
|
)
|
|
resolved_link = self._get_document_create_link()
|
|
self.assertNotEqual(resolved_link, None)
|