Example #1
0
 def setUp(self):
     currency, created = Currency.objects.get_or_create(
         code='EUR', name='Euro')
     MonthlyAverageFactory.create(
         year=1994, month=1, currency=currency, value=1.5)
     usd_currency, created = Currency.objects.get_or_create(
         code='USD', name='USD')
     MonthlyAverageFactory.create(
         year=1994, month=1, currency=usd_currency, value=3)
Example #2
0
    def test_update_rates(self):
        currency, created = Currency.objects.get_or_create(code='EUR', name='Euro')
        MonthlyAverageFactory.create(year=1994, month=1, currency=currency, value=1)
        self.rate_parser.create_browser = MagicMock()
        self.rate_parser.parse_data = MagicMock()
        self.rate_parser.save_averages = MagicMock()
        self.rate_parser.update_rates(force=False)

        self.assertEqual(12, self.rate_parser.parse_data.call_count)
Example #3
0
    def test_update_rates(self):
        currency, created = Currency.objects.get_or_create(
            code='EUR', name='Euro')
        MonthlyAverageFactory.create(
            year=1994, month=1, currency=currency, value=1)
        self.rate_parser.create_browser = MagicMock()
        self.rate_parser.parse_data = MagicMock()
        self.rate_parser.save_averages = MagicMock()
        self.rate_parser.update_rates(force=False)

        self.assertEqual(12, self.rate_parser.parse_data.call_count)