Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Fix/hardcoded currency 135 #3891

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: add currency localization test
wasuregusa18 committed Jan 11, 2023
commit d1b4a3f63678472a22c0aa59b540a4c584670aa6
19 changes: 19 additions & 0 deletions ecommerce/courses/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -133,6 +133,25 @@ def test_credit_providers_in_context(self):
json.loads(provider_json),
)

@responses.activate
def test_currency_localization(self):
"""Verify the currency symbol is localized based on settings"""
self._create_and_login_staff_user()
self.mock_access_token_response()
__ = self.mock_credit_api_providers()

response = self.client.get(self.path)
self.assertEqual(response.status_code, 200)
# default is USD
self.assertEqual(response.context["currency_symbol_"], "$")
self.assertEqual(response.context["currency_code_"], "USD")

with self.settings(PAID_COURSE_REGISTRATION_CURRENCY="GBP"):
response = self.client.get(self.path)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.context["currency_symbol_"], "£")
self.assertEqual(response.context["currency_code_"], "GBP")

@responses.activate
def test_credit_providers_in_context_cached(self):
""" Verify the cached context data includes a list of credit providers. """