Skip to content

Commit

Permalink
Fix test_hashes - server now needs more time to update hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
rkhwaja committed Nov 29, 2024
1 parent 59ef2cd commit d5b9217
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/test_onedrivefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,18 @@ def test_hashes(self):
hash_ = sha1() # noqa: S324
hash_.update(data)

self.assertEqual(hash_.hexdigest().upper(), self.fs.getinfo('DSCN0010.jpg').get('hashes', 'SHA1'))
# It takes time for the server to calculate the hashes
iterations = 50
sleepTime = 5
for iteration in range(iterations):
info_ = self.fs.getinfo('DSCN0010.jpg')
if info_.get('hashes', 'SHA1') is not None:
break
warning(f'Hashes not calculated in {iteration * sleepTime}s')
sleep(sleepTime)
else:
self.fail(f'Hashes not calculated in {iterations * sleepTime}s')
self.assertEqual(hash_.hexdigest().upper(), info_.get('hashes', 'SHA1'))

def test_download_as_format(self):
with self.fs.open('a.md', 'w') as f:
Expand Down

0 comments on commit d5b9217

Please sign in to comment.