def test_collection_crud(self): """ Create, Fetch, Update, and Delete a Collection """ title = "Fire 🔥 Collection" # Create: coll = api.create_collection(title) self.assertEqual(coll.title, title) self.assertIsInstance(coll.uuid, UUID) # Fetch: coll2 = api.get_collection(coll.uuid) self.assertEqual(coll, coll2) # Update: new_title = "Air 🌀 Collection" coll3 = api.update_collection(coll.uuid, title=new_title) self.assertEqual(coll3.title, new_title) coll4 = api.get_collection(coll.uuid) self.assertEqual(coll4.title, new_title) # Delete: api.delete_collection(coll.uuid) with self.assertRaises(api.CollectionNotFound): api.get_collection(coll.uuid)
def test_collection_crud(self): """ Create, Fetch, Update, and Delete a Collection """ title = "Fire 🔥 Collection" # Create: coll = api.create_collection(title) assert coll.title == title assert isinstance(coll.uuid, UUID) # Fetch: coll2 = api.get_collection(coll.uuid) assert coll == coll2 # Update: new_title = "Air 🌀 Collection" coll3 = api.update_collection(coll.uuid, title=new_title) assert coll3.title == new_title coll4 = api.get_collection(coll.uuid) assert coll4.title == new_title # Delete: api.delete_collection(coll.uuid) with pytest.raises(api.CollectionNotFound): api.get_collection(coll.uuid)
def test_nonexistent_collection(self): """ Request a collection that doesn't exist -> CollectionNotFound """ with self.assertRaises(api.CollectionNotFound): api.get_collection(BAD_UUID)