def success(payload): ''' If the record of ``Link`` removes failed, we will return a error payload. ''' mode = self.get_mode(payload) try: Link.rm(payload['da_id'], payload[mode], mode) except ValueError as err: payload['state'] = 'error' payload['reason'] = str(err) return payload
def test_link_rm_none(_link): with pytest.raises(ValueError) as err: Link.rm('id', 'feature', 'idf') assert 'unknown' in str(err)
def test_link_rm(_link): assert Link.add('id', 'feature', 'idf', 'topic') assert Link.rm('id', 'feature', 'idf')