def test_cascading_profile_delete(self): """Ensure that profile deletion cascades down to collections and WBOs""" (p, c, ah) = (self.profile, self.collection, self.auth_header) wbos = self.build_wbo_set() self.assert_(WBO.all().count() > 0) self.assert_(Collection.all().count() > 0) self.assert_(Profile.all().count() > 0) p.delete() self.assertEquals(0, WBO.all().count()) self.assertEquals(0, Collection.all().count()) self.assertEquals(0, Profile.all().count())
def tearDown(self): """Clean up after unit test""" # Is this actually needed, since storage is mocked? self.profile.delete() q = WBO.all() for o in q: o.delete() q = Collection.all() for o in q: o.delete()
def test_cascading_collection_delete(self): """Ensure that collection deletion cascades down to WBOs""" (p, c, ah) = (self.profile, self.collection, self.auth_header) wbos = self.build_wbo_set() count_all = WBO.all().count() collections = [c for c in Collection.all().ancestor(p)] for c in collections: c_count = len([x for x in c.retrieve()]) c.delete() count_all -= c_count self.assertEqual(count_all, WBO.all().count()) self.assertEqual(0, WBO.all().count())