Fix multiple tag selection wizard step
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
3.2 (2019-04-XX)
|
||||
================
|
||||
* Split sources models into separate modules
|
||||
* Split sources models into separate modules.
|
||||
* Add support for subfolder scanning to watchfolders. Closes
|
||||
GitLab issue #498 and #563.
|
||||
* Updated the source check behavior to allow checking a source
|
||||
even when the source is disabled and to not deleted processed files
|
||||
during a check.
|
||||
* Switch to full app paths
|
||||
* Switch to full app paths.
|
||||
* Fix multiple tag selection wizard step.
|
||||
|
||||
3.1.10 (2019-04-04)
|
||||
===================
|
||||
|
||||
@@ -24,6 +24,7 @@ Other changes
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
* Split source models into different modules.
|
||||
* Fix multiple tag selection wizard step.
|
||||
|
||||
Removals
|
||||
--------
|
||||
|
||||
@@ -5,6 +5,8 @@ TEST_TAG_LABEL_EDITED = 'test-tag-edited'
|
||||
TEST_TAG_COLOR = '#001122'
|
||||
TEST_TAG_COLOR_EDITED = '#221100'
|
||||
|
||||
TEST_TAG_LABEL_2 = 'test-tag-2'
|
||||
|
||||
TEST_TAG_INDEX_HAS_TAG = 'HAS_TAG'
|
||||
TEST_TAG_INDEX_NO_TAG = 'NO_TAG'
|
||||
TEST_TAG_INDEX_NODE_TEMPLATE = '''
|
||||
|
||||
@@ -12,10 +12,12 @@ from mayan.apps.sources.tests.literals import (
|
||||
|
||||
from ..models import Tag
|
||||
|
||||
from .literals import TEST_TAG_COLOR, TEST_TAG_LABEL
|
||||
from .literals import TEST_TAG_COLOR, TEST_TAG_LABEL, TEST_TAG_LABEL_2
|
||||
|
||||
|
||||
class TaggedDocumentUploadTestCase(GenericDocumentViewTestCase):
|
||||
auto_upload_document = False
|
||||
|
||||
def setUp(self):
|
||||
super(TaggedDocumentUploadTestCase, self).setUp()
|
||||
self.login_user()
|
||||
@@ -24,8 +26,6 @@ class TaggedDocumentUploadTestCase(GenericDocumentViewTestCase):
|
||||
uncompress=TEST_SOURCE_UNCOMPRESS_N
|
||||
)
|
||||
|
||||
self.document.delete()
|
||||
|
||||
def _request_upload_interactive_document_create_view(self):
|
||||
with open(TEST_SMALL_DOCUMENT_PATH, mode='rb') as file_object:
|
||||
return self.post(
|
||||
@@ -33,7 +33,7 @@ class TaggedDocumentUploadTestCase(GenericDocumentViewTestCase):
|
||||
data={
|
||||
'document_type_id': self.document_type.pk,
|
||||
'source-file': file_object,
|
||||
'tags': self.tag.pk
|
||||
'tags': ','.join(map(str, Tag.objects.values_list('pk', flat=True)))
|
||||
}
|
||||
)
|
||||
|
||||
@@ -42,11 +42,31 @@ class TaggedDocumentUploadTestCase(GenericDocumentViewTestCase):
|
||||
color=TEST_TAG_COLOR, label=TEST_TAG_LABEL
|
||||
)
|
||||
|
||||
def _create_tag_2(self):
|
||||
self.tag_2 = Tag.objects.create(
|
||||
color=TEST_TAG_COLOR, label=TEST_TAG_LABEL_2
|
||||
)
|
||||
|
||||
def test_upload_interactive_view_with_access(self):
|
||||
self._create_tag()
|
||||
|
||||
self.grant_access(
|
||||
permission=permission_document_create, obj=self.document_type
|
||||
)
|
||||
response = self._request_upload_interactive_document_create_view()
|
||||
self.assertEqual(response.status_code, 302)
|
||||
|
||||
self.assertTrue(self.tag in Document.objects.first().tags.all())
|
||||
|
||||
def test_upload_interactive_multiple_tags_view_with_access(self):
|
||||
self._create_tag()
|
||||
self._create_tag_2()
|
||||
|
||||
self.grant_access(
|
||||
permission=permission_document_create, obj=self.document_type
|
||||
)
|
||||
response = self._request_upload_interactive_document_create_view()
|
||||
self.assertEqual(response.status_code, 302)
|
||||
|
||||
self.assertTrue(self.tag in Document.objects.first().tags.all())
|
||||
self.assertTrue(self.tag_2 in Document.objects.first().tags.all())
|
||||
|
||||
@@ -45,7 +45,7 @@ class WizardStepTags(WizardStep):
|
||||
furl_instance = furl(querystring)
|
||||
Tag = apps.get_model(app_label='tags', model_name='Tag')
|
||||
|
||||
for tag in Tag.objects.filter(pk__in=furl_instance.args.getlist('tags')):
|
||||
for tag in Tag.objects.filter(pk__in=furl_instance.args['tags'].split(',')):
|
||||
tag.documents.add(document)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user