Change the way wizard steps are deregistered. Instead of deleting then from the _registry class dictionary they are filtered based on the _deregistry dictionary. This way de-registration can be reversed. Useful for tests.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -9,8 +9,10 @@ from sources.models import WebFormSource
|
||||
from sources.tests.literals import (
|
||||
TEST_SOURCE_LABEL, TEST_SOURCE_UNCOMPRESS_N
|
||||
)
|
||||
from sources.wizards import WizardStep
|
||||
|
||||
from ..models import Cabinet
|
||||
from ..wizard_steps import WizardStepCabinets
|
||||
|
||||
from .literals import TEST_CABINET_LABEL
|
||||
|
||||
@@ -26,6 +28,10 @@ class CabinetDocumentUploadTestCase(GenericDocumentViewTestCase):
|
||||
|
||||
self.document.delete()
|
||||
|
||||
def tearDown(self):
|
||||
super(CabinetDocumentUploadTestCase, self).tearDown()
|
||||
WizardStep.reregister_all()
|
||||
|
||||
def _request_upload_interactive_document_create_view(self):
|
||||
with open(TEST_SMALL_DOCUMENT_PATH) as file_object:
|
||||
return self.post(
|
||||
@@ -49,3 +55,17 @@ class CabinetDocumentUploadTestCase(GenericDocumentViewTestCase):
|
||||
|
||||
self.assertEqual(response.status_code, 302)
|
||||
self.assertTrue(self.cabinet in Document.objects.first().cabinets.all())
|
||||
|
||||
def _request_wizard_view(self):
|
||||
return self.get(viewname='sources:document_create_multiple')
|
||||
|
||||
def test_upload_interactive_cabinet_selection_view_with_access(self):
|
||||
WizardStep.deregister_all()
|
||||
WizardStep.reregister(name=WizardStepCabinets.name)
|
||||
|
||||
self._create_cabinet()
|
||||
self.grant_access(
|
||||
permission=permission_document_create, obj=self.document_type
|
||||
)
|
||||
response = self._request_wizard_view()
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
Reference in New Issue
Block a user