Skip to content

Commit

Permalink
Put text returned by mock requests in a single lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Almabekov committed Feb 11, 2019
1 parent 07893ca commit 2a4c04a
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions tests/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,12 @@ def test_get_results(self, reqmock):
def test_unique_currencies(self, reqmock):
# mock for the Exchange Rate table request
reqmock.get('https://api/exchange_rate_tables/abc_id',
status_code=200, text='{"id":"abc_id"}')
status_code=200, text='{"id": "abc_id"}')

fx_table = ExchangeRateTable.retrieve('abc_id')
# mock for the currencies method call
reqmock.get('https://api/exchange_rate_tables/abc_id/currencies', status_code=200,
text='{'
'"currencies": '
'[ '
'{"code": "CAD"}, '
'{"code": "EUR"} '
']'
'}')
reqmock.get('https://api/exchange_rate_tables/abc_id/currencies',
status_code=200, text='{"currencies": [{"code": "CAD"}, {"code": "EUR"}]}')
curr = fx_table.currencies()
assert hasattr(curr, 'currencies')
assert len(curr.currencies) == 2
Expand All @@ -111,12 +105,8 @@ def test_unique_currencies_empty(self, reqmock):
status_code=200, text='{"id":"abc_id"}')
fx_table = ExchangeRateTable.retrieve('abc_id')

reqmock.get('https://api/exchange_rate_tables/abc_id/currencies', status_code=200,
text='{'
'"currencies": '
'[ '
']'
'}')
reqmock.get('https://api/exchange_rate_tables/abc_id/currencies',
status_code=200, text='{"currencies": []}')
curr = fx_table.currencies()
assert hasattr(curr, 'currencies')
assert len(curr.currencies) == 0

0 comments on commit 2a4c04a

Please sign in to comment.