Skip to content

Commit

Permalink
add test to catch issue #12
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ11teen committed Aug 19, 2022
1 parent e93ba54 commit d1fecc3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/tests/2_singlecloudmapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,27 @@ def test_length(self, storage_provider: StorageProvider, test_id: str):

cm[key_3] = b"c"
assert len(cm) == 3

def test_subdir_sync(self, storage_provider: StorageProvider, test_id: str):
cm = CloudMapping(storage_provider=storage_provider, sync_initially=False)
prefix = test_id + "/subdir-sync-test"
key = prefix + "/filename"

assert prefix not in cm
assert key not in cm
assert len(cm) == 0

cm.sync_with_cloud(prefix)
assert prefix not in cm
assert key not in cm
assert len(cm) == 0

cm[key] = b"data"
assert prefix not in cm
assert key in cm
assert len(cm) == 1

cm.sync_with_cloud(prefix)
assert prefix not in cm
assert key in cm
assert len(cm) == 1

0 comments on commit d1fecc3

Please sign in to comment.