Skip to content

Commit

Permalink
fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvin-muchiri committed Aug 23, 2024
1 parent 12f827f commit 8642d48
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion onadata/apps/api/tests/viewsets/test_data_viewset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3782,7 +3782,10 @@ def test_data_retrieve_instance_osm_format(self):
self._publish_xls_form_to_project(xlsform_path=xlsform_path)
submission_path = os.path.join(osm_fixtures_dir, "instance_a.xml")
files = [open(path, "rb") for path in paths]
self._make_submission(submission_path, media_file=files)

with self.captureOnCommitCallbacks(execute=True):
# Ensure on commit callbacks are executed
self._make_submission(submission_path, media_file=files)
self.assertTrue(hasattr(self, "instance"))
self.assertEqual(self.instance.attachments.all().count(), len(files))

Expand Down
5 changes: 4 additions & 1 deletion onadata/libs/tests/utils/test_export_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ def test_generate_osm_export(self):
self._publish_xls_file_and_set_xform(xlsform_path)
submission_path = os.path.join(osm_fixtures_dir, "instance_a.xml")
count = Attachment.objects.filter(extension="osm").count()
self._make_submission_w_attachment(submission_path, paths)

with self.captureOnCommitCallbacks(execute=True):
# Ensure on commit callbacks are executed
self._make_submission_w_attachment(submission_path, paths)
self.assertTrue(Attachment.objects.filter(extension="osm").count() > count)

options = {"extension": Attachment.OSM}
Expand Down

0 comments on commit 8642d48

Please sign in to comment.