@@ -1612,7 +1612,6 @@ def test_update_timestamp_feature_fails_with_unfound_item(
16121612        """ 
16131613        ENDPOINT: PUT: /catalog/collections/{user:collection}/items/{featureID} 
16141614        """ 
1615- 
16161615        # Change correct feature collection id to match with minimal collection and post it 
16171616        a_correct_feature ["collection" ] =  "fixture_collection" 
16181617        # Post the correct feature to catalog 
@@ -1628,13 +1627,57 @@ def test_update_timestamp_feature_fails_with_unfound_item(
16281627        updated_feature_sent ["bbox" ] =  [77 ]
16291628        del  updated_feature_sent ["collection" ]
16301629
1631-         path  =  "/catalog/collections/fixture_owner:fixture_collections /items/NOT_FOUND_ITEM" 
1630+         path  =  "/catalog/collections/fixture_owner:fixture_collection /items/NOT_FOUND_ITEM" 
16321631        feature_put_response  =  client .put (
16331632            path ,
16341633            json = updated_feature_sent ,
16351634        )
16361635        assert  feature_put_response .status_code  ==  fastapi .status .HTTP_400_BAD_REQUEST 
16371636
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+ 
16381681    def  test_update_with_an_incorrect_feature (self , client , a_minimal_collection , a_correct_feature ):
16391682        """Testing POST feature endpoint with a wrong-formatted field (BBOX).""" 
16401683        # Change correct feature collection id to match with minimal collection and post it 
0 commit comments