def get_channel_list(self, token_address=None, partner_address=None): raiden_service_result = self.raiden_api.get_channel_list(token_address, partner_address) assert isinstance(raiden_service_result, list) channel_list = ChannelList(raiden_service_result) result = self.channel_list_schema.dump(channel_list) return api_response(result=result.data)
def get_channel_list(self, asset_address=None, partner_address=None): api_result = self.raiden_api.get_channel_list(asset_address, partner_address) assert isinstance(api_result, list) # wrap in ChannelList: channel_list = ChannelList(api_result) result = self.channel_list_schema.dumps(channel_list) return result
def test_channel_list(channel_list_mock): assert isinstance(channel_list_mock, list) # has to be wrapped in a ChannelList, which uses same interface as list channel_list = ChannelList(channel_list_mock) schema = ChannelListSchema() ser_iterable = schema.dump(channel_list).data deser_iterable = schema.load(ser_iterable).data assert isinstance(deser_iterable, ChannelList) for channel, deserialized_channel in zip(channel_list, deser_iterable): assert_channel_deserialization(channel, deserialized_channel)
def expect_channels(self): channel_list = ChannelList(self.channels) return json.loads(self.channel_list_schema.dumps(channel_list).data)