def test_delete_object(self): obj = api.create_obj( self.collection, self.agent, 'collectionobject', { 'collection': api.uri_for_model('collection', self.collection.id), 'catalognumber': 'foobar' }) api.delete_obj(self.agent, 'collectionobject', obj.id, obj.version) self.assertEqual( models.Collectionobject.objects.filter(id=obj.id).count(), 0)
def test_delete_object(self): obj = api.create_obj(self.collection, self.agent, 'collectionobject', { 'collection': api.uri_for_model('collection', self.collection.id), 'catalognumber': 'foobar'}) data = api.get_resource('collectionobject', obj.id) obj.version += 1 obj.save() with self.assertRaises(api.StaleObjectException) as cm: api.delete_obj(self.agent, 'collectionobject', data['id'], data['version']) self.assertEqual(models.Collectionobject.objects.filter(id=obj.id).count(), 1)
def test_delete_object(self): obj = api.create_obj( self.collection, self.agent, 'collectionobject', { 'collection': api.uri_for_model('collection', self.collection.id), 'catalognumber': 'foobar' }) data = api.get_resource('collectionobject', obj.id) obj.version += 1 obj.save() with self.assertRaises(api.StaleObjectException) as cm: api.delete_obj(self.agent, 'collectionobject', data['id'], data['version']) self.assertEqual( models.Collectionobject.objects.filter(id=obj.id).count(), 1)
def test_delete_object(self): obj = api.create_obj(self.collection, self.agent, 'collectionobject', { 'collection': api.uri_for_model('collection', self.collection.id), 'catalognumber': 'foobar'}) api.delete_obj(self.agent, 'collectionobject', obj.id, obj.version) self.assertEqual(models.Collectionobject.objects.filter(id=obj.id).count(), 0)