Skip to content

Commit

Permalink
Fix delay in test for for deletion page
Browse files Browse the repository at this point in the history
Following from the partial fix added in #2839
  • Loading branch information
MonkeyDo committed Apr 26, 2024
1 parent 16d233b commit a5a6d6a
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions listenbrainz/tests/integration/test_settings_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,18 @@ def test_delete_listens(self):
if not ok:
self.assertEqual(json.loads(resp.data)['payload']['count'], 0)

# check that the latest_import timestamp has been reset too
resp = self.client.get(self.custom_url_for('api_v1.latest_import', user_name=self.user['musicbrainz_id']))
self.assert200(resp)
self.assertEqual(resp.json['latest_import'], 0)
# wait for background tasks to be processed -- max 30s allowed for the test to pass
ok = False
for i in range(30):
time.sleep(1)

# check that the latest_import timestamp has been reset too
resp = self.client.get(self.custom_url_for('api_v1.latest_import', user_name=self.user['musicbrainz_id']))
self.assert200(resp)
if json.loads(resp.data)['latest_import'] == 0:
continue
else:
ok = True

if not ok:
self.assertEqual(resp.json['latest_import'], 0)

0 comments on commit a5a6d6a

Please sign in to comment.