def delete(self): """ Delete the associated object. This passes to the RequestApi to raise a delete request, so does not necessarily happen immediately :return: """ # only allow delete to be called on a record where the requester has a stake in it # in reality, this doesn't really matter, as a request with no stake will just have no # effect, but this may be a clearer reaction to the user's request, and also may cut down # on effect-less requests. if self.public_record is not None: if self.account.id not in self.public_record.list_owners(): raise AuthorisationException("You may only request delete on a record where you have previously provided data") self.request = RequestApi.delete(self.raw, account=self.account, public_id=self.public_id)
def test_01_request_delete(self): # Create a delete request record = RequestFixtureFactory.record() acc = BasicAccount() acc.id = "test1" r = RequestApi.delete(record, acc, "01010101") # now check it was saved correctly assert r is not None r1 = r.pull(r.id) assert r1 is not None assert r1.owner == acc.id assert r1.action == "delete" assert r1.public_id == "01010101"