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>
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
from __future__ import unicode_literals
|
|
|
|
from actstream.models import Action
|
|
|
|
from mayan.apps.documents.tests.test_models import GenericDocumentTestCase
|
|
|
|
from ..events import (
|
|
event_cabinets_add_document, event_cabinets_remove_document
|
|
)
|
|
from ..models import Cabinet
|
|
|
|
from .literals import TEST_CABINET_LABEL
|
|
|
|
|
|
class CabinetsEventsTestCase(GenericDocumentTestCase):
|
|
def setUp(self):
|
|
super(CabinetsEventsTestCase, self).setUp()
|
|
self._create_cabinet()
|
|
|
|
def _create_cabinet(self):
|
|
self.cabinet = Cabinet.objects.create(label=TEST_CABINET_LABEL)
|
|
|
|
def test_document_cabinet_add_event(self):
|
|
Action.objects.all().delete()
|
|
self.cabinet.add_document(document=self.document)
|
|
|
|
self.assertEqual(Action.objects.last().target, self.document)
|
|
self.assertEqual(
|
|
Action.objects.last().verb,
|
|
event_cabinets_add_document.id
|
|
)
|
|
|
|
def test_document_cabinet_remove_event(self):
|
|
self.cabinet.add_document(document=self.document)
|
|
Action.objects.all().delete()
|
|
self.cabinet.remove_document(document=self.document)
|
|
|
|
self.assertEqual(Action.objects.first().target, self.document)
|
|
self.assertEqual(
|
|
Action.objects.first().verb,
|
|
event_cabinets_remove_document.id
|
|
)
|