@@ -1612,7 +1612,6 @@ def test_update_timestamp_feature_fails_with_unfound_item(
1612
1612
"""
1613
1613
ENDPOINT: PUT: /catalog/collections/{user:collection}/items/{featureID}
1614
1614
"""
1615
-
1616
1615
# Change correct feature collection id to match with minimal collection and post it
1617
1616
a_correct_feature ["collection" ] = "fixture_collection"
1618
1617
# Post the correct feature to catalog
@@ -1628,13 +1627,57 @@ def test_update_timestamp_feature_fails_with_unfound_item(
1628
1627
updated_feature_sent ["bbox" ] = [77 ]
1629
1628
del updated_feature_sent ["collection" ]
1630
1629
1631
- path = "/catalog/collections/fixture_owner:fixture_collections /items/NOT_FOUND_ITEM"
1630
+ path = "/catalog/collections/fixture_owner:fixture_collection /items/NOT_FOUND_ITEM"
1632
1631
feature_put_response = client .put (
1633
1632
path ,
1634
1633
json = updated_feature_sent ,
1635
1634
)
1636
1635
assert feature_put_response .status_code == fastapi .status .HTTP_400_BAD_REQUEST
1637
1636
1637
+ def test_update_feature_in_non_existing_collection_fails (
1638
+ self ,
1639
+ client ,
1640
+ a_minimal_collection ,
1641
+ a_correct_feature ,
1642
+ ):
1643
+ """
1644
+ ENDPOINT: PUT: /catalog/collections/{user:collection}/items/{featureID}
1645
+ with collection as non existing collection
1646
+ """
1647
+ # Change correct feature collection id to match with minimal collection
1648
+ a_correct_feature ["collection" ] = "fixture_collection"
1649
+ # Put feature in non existing collection
1650
+ non_existing_collection = "NON_EXISTING_FIXTURE_COLLECTION"
1651
+ feature_put_response = client .put (
1652
+ f"/catalog/collections/fixture_owner:{ non_existing_collection } /items/{ a_correct_feature ['id' ]} " ,
1653
+ json = a_correct_feature ,
1654
+ )
1655
+
1656
+ assert feature_put_response .status_code == fastapi .status .HTTP_404_NOT_FOUND
1657
+ assert feature_put_response .json () == f"Collection { non_existing_collection } does not exist."
1658
+
1659
+ def test_add_feature_in_non_existing_collection_fails (
1660
+ self ,
1661
+ client ,
1662
+ a_minimal_collection ,
1663
+ a_correct_feature ,
1664
+ ):
1665
+ """
1666
+ ENDPOINT: POST: /catalog/collections/{user:collection}/items/
1667
+ with collection as non existing collection
1668
+ """
1669
+ # Change correct feature collection id to match with minimal collection and post it
1670
+ a_correct_feature ["collection" ] = "fixture_collection"
1671
+ # Post the correct feature to catalog
1672
+ non_existing_collection = "NON_EXISTING_FIXTURE_COLLECTION"
1673
+ feature_post_response = client .post (
1674
+ f"/catalog/collections/fixture_owner:{ non_existing_collection } /items" ,
1675
+ json = a_correct_feature ,
1676
+ )
1677
+
1678
+ assert feature_post_response .status_code == fastapi .status .HTTP_404_NOT_FOUND
1679
+ assert feature_post_response .json () == f"Collection { non_existing_collection } does not exist."
1680
+
1638
1681
def test_update_with_an_incorrect_feature (self , client , a_minimal_collection , a_correct_feature ):
1639
1682
"""Testing POST feature endpoint with a wrong-formatted field (BBOX)."""
1640
1683
# Change correct feature collection id to match with minimal collection and post it
0 commit comments