From 762fd9e408b7ab4e74ceff68be158ccea4658953 Mon Sep 17 00:00:00 2001 From: RuthShryock Date: Mon, 29 Jul 2024 10:47:03 -0400 Subject: [PATCH] revising test to check that uuids are string values --- .../tests/test_submission_stream.py | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/kobo/apps/subsequences/tests/test_submission_stream.py b/kobo/apps/subsequences/tests/test_submission_stream.py index a31021506b..4542d603e1 100644 --- a/kobo/apps/subsequences/tests/test_submission_stream.py +++ b/kobo/apps/subsequences/tests/test_submission_stream.py @@ -261,18 +261,27 @@ def test_stream_with_extras_handles_duplicated_submission_uuids(self): self.asset.deployment.mock_submissions(submissions) # Process submissions with extras - try: - _ = list( - stream_with_extras( - self.asset.deployment.get_submissions( - user=self.asset.owner - ), - self.asset, - ) + output = list( + stream_with_extras( + self.asset.deployment.get_submissions(user=self.asset.owner), + self.asset, ) - except TypeError as e: - self.fail(f"TypeError occurred: {e}") - self.assertTrue(True) + ) + + # Make sure that uuid values for single or multiple choice qualitative + # analysis questions are kept as strings and not mutated + for submission in output: + supplemental_details = submission['_supplementalDetails'] + for qual_response in supplemental_details['Tell_me_a_story']['qual']: + if qual_response['type'] not in [ + 'qual_select_one', + 'qual_select_multiple', + ]: + # question is not a single or multiple choice one + continue + + for v in qual_response['val']: + assert isinstance(v['uuid'], str) # Clear all mocked submissions to avoid duplicate submission errors self.asset.deployment.mock_submissions([])