Skip to content

Commit

Permalink
feat: code review
Browse files Browse the repository at this point in the history
  • Loading branch information
UvgenGen committed May 11, 2022
1 parent 2d82aeb commit 8633e7a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
5 changes: 2 additions & 3 deletions ecommerce/core/management/commands/create_or_update_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,8 @@ def add_arguments(self, parser):
action='store',
dest='payment_microfrontend_url',
type=str,
required=False,
help='URL for the Payment Microfrontend '
'(used if Enable Microfrontend for Basket Page is set)')
required=True,
help='URL for the Payment Microfrontend.')

def handle(self, *args, **options): # pylint: disable=too-many-statements
site_id = options.get('site_id')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def setUp(self):
self.payment_support_url = 'http://fake.server/support'
self.base_cookie_domain = '.fake.server'
self.discovery_api_url = 'https://fake.discovery.server/api/v1/'
self.payment_microfrontend_url = 'http://payment_mfe_fake.server'

def _check_site_configuration(self, site, partner):
site_configuration = site.siteconfiguration
Expand Down Expand Up @@ -92,6 +93,7 @@ def _call_command(self,
backend_service_client_id,
backend_service_client_secret,
from_email,
payment_microfrontend_url,
lms_public_url_root=None,
site_id=None,
site_name=None,
Expand All @@ -118,7 +120,8 @@ def _call_command(self,
'--sso-client-secret={}'.format(sso_client_secret),
'--backend-service-client-id={}'.format(backend_service_client_id),
'--backend-service-client-secret={}'.format(backend_service_client_secret),
'--from-email={from_email}'.format(from_email=from_email)
'--from-email={from_email}'.format(from_email=from_email),
'--payment-microfrontend-url={}'.format(payment_microfrontend_url),
]

# Optional arguments
Expand Down Expand Up @@ -186,6 +189,7 @@ def test_create_site(self):
backend_service_client_secret=self.backend_service_client_secret,
segment_key=self.segment_key,
from_email=self.from_email,
payment_microfrontend_url=self.payment_microfrontend_url,
discovery_api_url=self.discovery_api_url,
)

Expand Down Expand Up @@ -218,6 +222,7 @@ def test_update_site(self):
backend_service_client_secret=self.backend_service_client_secret,
segment_key=self.segment_key,
from_email=self.from_email,
payment_microfrontend_url=self.payment_microfrontend_url,
enable_enrollment_codes=True,
payment_support_email=self.payment_support_email,
payment_support_url=self.payment_support_url,
Expand All @@ -239,7 +244,8 @@ def test_update_site(self):
self.assertEqual(site_configuration.payment_support_email, self.payment_support_email)
self.assertEqual(site_configuration.payment_support_url, self.payment_support_url)
self.assertTrue(site_configuration.send_refund_notifications)
self.assertEqual(site.siteconfiguration.base_cookie_domain, self.base_cookie_domain)
self.assertEqual(site_configuration.base_cookie_domain, self.base_cookie_domain)
self.assertEqual(site_configuration.payment_microfrontend_url, self.payment_microfrontend_url)

def test_update_site_with_updated_oauth(self):
"""
Expand All @@ -265,6 +271,7 @@ def test_update_site_with_updated_oauth(self):
backend_service_client_secret=self.backend_service_client_secret,
segment_key=self.segment_key,
from_email=self.from_email,
payment_microfrontend_url=self.payment_microfrontend_url,
enable_enrollment_codes=True,
payment_support_email=self.payment_support_email,
payment_support_url=self.payment_support_url,
Expand All @@ -286,7 +293,8 @@ def test_update_site_with_updated_oauth(self):
self.assertEqual(site_configuration.payment_support_email, self.payment_support_email)
self.assertEqual(site_configuration.payment_support_url, self.payment_support_url)
self.assertTrue(site_configuration.send_refund_notifications)
self.assertEqual(site.siteconfiguration.base_cookie_domain, self.base_cookie_domain)
self.assertEqual(site_configuration.base_cookie_domain, self.base_cookie_domain)
self.assertEqual(site_configuration.payment_microfrontend_url, self.payment_microfrontend_url)

@data(
['--site-id=1'],
Expand Down
2 changes: 1 addition & 1 deletion ecommerce/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class SiteConfiguration(models.Model):
)
payment_microfrontend_url = models.URLField(
verbose_name=_('Payment Microfrontend URL'),
help_text=_('URL for the Payment Microfrontend (used if Enable Microfrontend for Basket Page is set)'),
help_text=_('URL for the Payment Microfrontend'),
null=True,
blank=True
)
Expand Down

0 comments on commit 8633e7a

Please sign in to comment.