Skip to content

Commit

Permalink
Update U-DS test for collection deleteion
Browse files Browse the repository at this point in the history
  • Loading branch information
leebrian committed Jan 6, 2025
1 parent 09602de commit ec3fa75
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion libs/unity-py/tests/test_unity_data_service.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unity_sds_client.unity import Unity
from unity_sds_client.unity_exception import UnityException
from unity_sds_client.unity_session import UnitySession
from unity_sds_client.unity import UnityEnvironments
from unity_sds_client.resources.collection import Collection
from unity_sds_client.unity_services import UnityServices as Services

Expand Down Expand Up @@ -47,4 +48,19 @@ def test_collection_creation(cleanup_update_test):
s.set_project("unity")
s.set_venue("test")
ds = s.client(Services.DATA_SERVICE)
ds.create_collection(Collection("urn:nasa:unity:unity:test:my_collection_id"), True)
ds.create_collection(Collection("urn:nasa:unity:unity:test:my_collection_id"), True)

def test_collection_deletion():

unity = Unity(UnityEnvironments.TEST)
token = unity._session.get_auth().get_token()
data_service = unity.client(Services.DATA_SERVICE)

collections = data_service.get_collections(100)

granule_id = 'urn:nasa:unity:emit:dev:unity-tutorial___1:summary_table.txt'

for i in range(len(collections)):
if granule_id in collections[i].collection_id:
data_service.delete_collection_data(collections[i], granule_id)
break

0 comments on commit ec3fa75

Please sign in to comment.