Skip to content

Commit

Permalink
add test for duplicated submission uuids
Browse files Browse the repository at this point in the history
  • Loading branch information
RuthShryock committed Jul 25, 2024
1 parent e14ebdc commit 38b2a64
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions kobo/apps/subsequences/tests/test_submission_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,38 @@ def mock_submission_stream():
assert '_supplementalDetails' in output[0]
assert '_supplementalDetails' in output[1]
# test other things?

def test_stream_with_extras_handles_duplicated_submission_uuids(self):
# Define submission data with duplicated UUIDs
submissions = [
{
'What_s_your_name': 'Ed',
'Tell_me_a_story': 'ed-18_6_24.ogg',
'meta/instanceID': 'uuid:1c05898e-b43c-491d-814c-79595eb84e81',
'_uuid': '1c05898e-b43c-491d-814c-79595eb84e81',
},
{
'What_s_your_name': 'Ed',
'Tell_me_a_story': 'ed-18_6_44.ogg',
'meta/instanceID': 'uuid:1c05898e-b43c-491d-814c-79595eb84e81',
'_uuid': '1c05898e-b43c-491d-814c-79595eb84e81',
},
]
self.asset.deployment.mock_submissions(submissions)

# Process submissions with extras
try:
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)

# Clear all mocked submissions to avoid duplicate submission errors
self.asset.deployment.mock_submissions([])

0 comments on commit 38b2a64

Please sign in to comment.