mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-04-28 17:32:38 +02:00
add test to show the failure
This commit is contained in:
parent
b32abadd05
commit
7a55fb23fa
1 changed files with 7 additions and 0 deletions
|
@ -382,6 +382,13 @@ class TestCurrencyConverter(unittest.TestCase):
|
|||
result = self.converter.exchange_currency(100, "USD", "EUR")
|
||||
self.assertEqual(result, 80.0)
|
||||
|
||||
def test_failing_remote(self):
|
||||
with patch("requests.Response.json", new=lambda _: {}):
|
||||
# we need a non-patched converter, but it seems that MagickMock
|
||||
# is mocking EVERY instance of the class method. Too bad.
|
||||
rates = CurrencyConverter.get_rates(self.converter)
|
||||
self.assertDictEqual(rates, {CurrencyConverter.no_currency: 1})
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in a new issue