diff --git a/kobo/apps/openrosa/apps/logger/tests/test_form_submission.py b/kobo/apps/openrosa/apps/logger/tests/test_form_submission.py index b7c63fc71d..78fd0b9a88 100644 --- a/kobo/apps/openrosa/apps/logger/tests/test_form_submission.py +++ b/kobo/apps/openrosa/apps/logger/tests/test_form_submission.py @@ -307,7 +307,8 @@ def test_duplicate_submission_with_same_content_but_with_different_attachment(se ) media_file_path2 = os.path.join( os.path.dirname(__file__), - '../fixtures/tutorial/instances/tutorial_with_attachment/attachment_with_different_content', + '../fixtures/tutorial/instances/tutorial_with_attachment/' + 'attachment_with_different_content', '1335783522563.jpg', ) initial_instance_count = Instance.objects.count() @@ -336,7 +337,8 @@ def test_duplicate_submission_with_same_content_but_with_different_attachment(se Attachment.objects.filter(instance=initial_instance).count(), 1 ) - # Test duplicate submission with same attachment (different file name) + # Test duplicate submission with same attachment name but with + # different content with open(media_file_path2, 'rb') as media_file2: self._make_submission(xml_submission_file_path, media_file=media_file2) self.assertEqual(self.response.status_code, 202) diff --git a/kobo/apps/openrosa/libs/tests/mixins/make_submission_mixin.py b/kobo/apps/openrosa/libs/tests/mixins/make_submission_mixin.py index 80e7f219ca..5be84a5640 100644 --- a/kobo/apps/openrosa/libs/tests/mixins/make_submission_mixin.py +++ b/kobo/apps/openrosa/libs/tests/mixins/make_submission_mixin.py @@ -55,9 +55,9 @@ def _add_submission_uuid_to_submission_xml(self, path): # Insert the meta element before the closing tag of the root element xml_content = ( - xml_content[:closing_tag_index] + - meta_element + - xml_content[closing_tag_index:] + xml_content[:closing_tag_index] + + meta_element + + xml_content[closing_tag_index:] ) # Write the updated XML content to a temporary file and return the path diff --git a/kobo/apps/openrosa/libs/utils/logger_tools.py b/kobo/apps/openrosa/libs/utils/logger_tools.py index c148d2d872..f135091046 100644 --- a/kobo/apps/openrosa/libs/utils/logger_tools.py +++ b/kobo/apps/openrosa/libs/utils/logger_tools.py @@ -51,7 +51,6 @@ from kobo.apps.openrosa.apps.logger.models import Attachment, Instance, XForm from kobo.apps.openrosa.apps.logger.models.attachment import ( generate_attachment_filename, - hash_attachment_contents, ) from kobo.apps.openrosa.apps.logger.models.instance import ( InstanceHistory, diff --git a/kpi/tests/api/v2/test_api_submissions.py b/kpi/tests/api/v2/test_api_submissions.py index d2c91c9844..87edaa52bb 100644 --- a/kpi/tests/api/v2/test_api_submissions.py +++ b/kpi/tests/api/v2/test_api_submissions.py @@ -1596,8 +1596,8 @@ def test_edit_submission_with_xml_missing_uuids(self): assert submission_json['_id'] == submission['_id'] assert submission_xml_root.find('./find_this').text == 'hello!' assert ( - submission_xml_root.find('./meta/instanceID').text - == 'uuid:9710c729-00a5-41f1-b740-8dd618bb4a49' + submission_xml_root.find('./meta/instanceID').text == + 'uuid:9710c729-00a5-41f1-b740-8dd618bb4a49' ) assert submission_xml_root.find('./formhub/uuid') is None