Skip to content

Commit

Permalink
listTransferMethods not handling response as a list
Browse files Browse the repository at this point in the history
  • Loading branch information
ukrarome committed May 20, 2022
1 parent 68ded29 commit 876bbdd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion hyperwallet/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3144,7 +3144,7 @@ def listTransferMethods(self,
params
)

return TransferMethod(response)
return [TransferMethod(x) for x in response.get('data', [])]

'''
Expand Down
9 changes: 5 additions & 4 deletions hyperwallet/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2652,6 +2652,7 @@ def test_list_webhooks_success(self, mock_get):
Upload Documents
'''

def test_uploadDocumentsForUser_fail_need_user_token(self):

with self.assertRaises(HyperwalletException) as exc:
Expand Down Expand Up @@ -2963,18 +2964,18 @@ def test_list_transfer_methods_fail_need_params_invalid(self):
def test_list_transfer_methods_params_valid(self, mock_get):

options = {'type': 'test'}
mock_get.return_value = self.data
mock_get.return_value = {'data': [self.data]}
response = self.api.listTransferMethods('token', options)

self.assertTrue(response.token, self.data.get('token'))
self.assertTrue(response[0].token, self.data.get('token'))

@mock.patch('hyperwallet.utils.ApiClient._makeRequest')
def test_list_transfer_methods_success(self, mock_get):

mock_get.return_value = self.data
mock_get.return_value = {'data': [self.data]}
response = self.api.listTransferMethods('token')

self.assertTrue(response.token, self.data.get('token'))
self.assertTrue(response[0].token, self.data.get('token'))


if __name__ == '__main__':
Expand Down

0 comments on commit 876bbdd

Please sign in to comment.