From bbd95f2c7059255b6217d01ea0c338b96deb8eae Mon Sep 17 00:00:00 2001 From: eeintech Date: Thu, 20 May 2021 14:52:56 -0400 Subject: [PATCH] Fixed exchange rate backend test --- InvenTree/InvenTree/tasks.py | 2 +- InvenTree/company/tests.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/InvenTree/InvenTree/tasks.py b/InvenTree/InvenTree/tasks.py index 0468365dae..b3649bcdcf 100644 --- a/InvenTree/InvenTree/tasks.py +++ b/InvenTree/InvenTree/tasks.py @@ -176,7 +176,7 @@ def update_exchange_rates(): backend = get_exchange_rate_backend() # Update rates - backend.update_rates() + backend.update_rates(base_currency=backend.base_currency) def send_email(subject, body, recipients, from_email=None): diff --git a/InvenTree/company/tests.py b/InvenTree/company/tests.py index 5dd3bf81ab..e07516e180 100644 --- a/InvenTree/company/tests.py +++ b/InvenTree/company/tests.py @@ -11,7 +11,7 @@ from .models import Company, Contact, ManufacturerPart, SupplierPart from .models import rename_company_image from part.models import Part -from InvenTree.exchange import InvenTreeManualExchangeBackend +from InvenTree.exchange import get_exchange_rate_backend from djmoney.contrib.exchange.models import Rate @@ -40,13 +40,15 @@ class CompanySimpleTest(TestCase): self.acme0002 = SupplierPart.objects.get(SKU='ACME0002') self.zerglphs = SupplierPart.objects.get(SKU='ZERGLPHS') self.zergm312 = SupplierPart.objects.get(SKU='ZERGM312') - - InvenTreeManualExchangeBackend().update_rates() + + # Exchange rate backend + backend = get_exchange_rate_backend() + backend.update_rates(base_currency=backend.base_currency) Rate.objects.create( currency='AUD', value='1.35', - backend_id='inventree', + backend_id=backend.name, ) def test_company_model(self):