Skip to content

Commit

Permalink
add test to catch content based etags
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ11teen committed May 16, 2021
1 parent 9e2ca86 commit d6596cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions tests/tests/1_storageproviders.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,11 @@ def test_etags_are_enforced(self, storage_provider: StorageProvider, test_id: st
storage_provider.upload_data(key, "bad-etag", b"data")
with pytest.raises(KeySyncError):
storage_provider.delete_data(key, "bad-etag")

def test_etags_change_with_same_data(self, storage_provider: StorageProvider, test_id: str):
key = test_id + "etags-unique-same-data-test"

first_etag = storage_provider.upload_data(key, None, b"static-data")
second_etag = storage_provider.upload_data(key, first_etag, b"static-data")

assert first_etag != second_etag
2 changes: 1 addition & 1 deletion tests/tests/3_multiplecloudmapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_no_ownership_error(self, storage_provider: StorageProvider, test_id: st
sess_3 = CloudMapping(storageprovider=storage_provider)
# Session 1 updates the key:
sess_1[key] = b"session_1"
# Session 3 is knows the key exists, so KeySyncError on get, set and delete:
# Session 3 knows the key exists, but is out of sync so KeySyncError on get, set and delete:
with pytest.raises(KeySyncError):
sess_3[key]
with pytest.raises(KeySyncError):
Expand Down

0 comments on commit d6596cc

Please sign in to comment.