From 966d11638629ad5239f0cbb1efdcdae304744531 Mon Sep 17 00:00:00 2001 From: Federico Dolce Date: Fri, 2 Dec 2016 12:21:55 +0100 Subject: [PATCH] Added test to avoid regression on update_rates command --- tests/test_commands.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_commands.py b/tests/test_commands.py index 92641c0..d108334 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -7,6 +7,7 @@ from djmoney_rates.backends import BaseRateBackend from djmoney_rates.models import Rate, RateSource +from djmoney_rates.settings import money_rates_settings class CustomBackend(BaseRateBackend): @@ -27,3 +28,13 @@ def test_custom_backend_used_when_specified(self): self.assertEqual(1, RateSource.objects.filter(name="custom-backend").count()) self.assertEqual(2, Rate.objects.filter(source__name="custom-backend").count()) + + def test_default_backend_used_when_not_specified(self): + """ + Test that if no backend is passed as parameter, the default one is used + """ + money_rates_settings.DEFAULT_BACKEND = CustomBackend + call_command("update_rates") + + self.assertEqual(1, RateSource.objects.filter(name="custom-backend").count()) + self.assertEqual(2, Rate.objects.filter(source__name="custom-backend").count())