Skip to content

Commit

Permalink
tests: conflict checks
Browse files Browse the repository at this point in the history
  • Loading branch information
akhileshh committed Aug 22, 2024
1 parent 695741c commit 6b3ae5e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/unit/db_annotations/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ def test_add_update_delete_collection(firestore_emulator, collections_db):
old_user = "john_doe"
old_name = "test_collection0"
_id = collection.add_collection(old_name, old_user, "this is a test")

with pytest.raises(KeyError):
collection.add_collection(old_name, old_user, "this is a test")

_collection = collection.read_collection(_id)
assert _collection["name"] == old_name
assert _collection["created_by"] == old_user
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/db_annotations/test_layer_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ def test_add_update_delete_layer_group(firestore_emulator, layer_groups_db):
layers=layers_ids,
comment="this is a test",
)

with pytest.raises(KeyError):
layer_group.add_layer_group(
name=old_name,
collection_id=collection_id,
user=user,
layers=layers_ids,
comment="this is a test",
)

_layer_group = layer_group.read_layer_group(_id)
assert _layer_group["name"] == old_name
assert len(cast(list, _layer_group["layers"])) == 2
Expand Down

0 comments on commit 6b3ae5e

Please sign in to comment.