Skip to content

Commit

Permalink
Added test to avoid regression on update_rates command
Browse files Browse the repository at this point in the history
  • Loading branch information
Psykopear committed Dec 2, 2016
1 parent 7e70091 commit 966d116
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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())

0 comments on commit 966d116

Please sign in to comment.