test_import_export: Fix a flaky test due to random reactions added.

The reactions added to messages in the test database are
random in nature, so there is a possibility of any number
of reaction records in the exported user data.

The test now verifies the reaction which was added in the test
itself.

Earlier, the test was assuming the reaction added in the test
is the only record in the exported data.

That would result in a flaky behavior. This commit fixes the
flaky behavior.
This commit is contained in:
Prakhar Pratyush 2024-05-09 22:38:34 +05:30 committed by Tim Abbott
parent 20fbba6375
commit 6baf981aa5
1 changed files with 1 additions and 2 deletions

View File

@ -1908,9 +1908,8 @@ class SingleUserExportTest(ExportFile):
@checker
def zerver_reaction(records: List[Record]) -> None:
assert reaction
(exported_reaction,) = records
self.assertEqual(
exported_reaction,
records[-1],
dict(
id=reaction.id,
user_profile=cordelia.id,