Skip to content

Commit

Permalink
Merge pull request #11 from edly-io/tai/EDLY-3642
Browse files Browse the repository at this point in the history
Domain changes for site automation
  • Loading branch information
taimoor-ahmed-1 authored Oct 22, 2021
2 parents 4eadb33 + b0402f3 commit 055936a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def process_client_sites_setup(self):
"""
edly_slug = self.request.data.get('edly_slug', '')
credentials_base = self.request.data.get('credentials_site', '')
old_credentials_base = self.request.data.get('old_domain_values', {}).get('credentials_site', None)
theme_dir_name = self.request.data.get('theme_dir_name', 'openedx')
lms_url_root = '{protocol}://{lms_url_root}'.format(
protocol=self.request.data.get('protocol', 'https'),
Expand All @@ -61,7 +62,11 @@ def process_client_sites_setup(self):
protocol=self.request.data.get('protocol', 'https'),
wordpress_site=self.request.data.get('wordpress_site', '')
)
credentials_site, __ = Site.objects.update_or_create(domain=credentials_base, defaults=dict(name=credentials_base))
credentials_site, __ = Site.objects.update_or_create(
domain=old_credentials_base,
name=old_credentials_base,
defaults={'domain': credentials_base, 'name': credentials_base},
)
credentials_site_config, __ = SiteConfiguration.objects.update_or_create(
site=credentials_site,
defaults=dict(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ def test_client_setup_idempotent(self):

sites_count = Site.objects.all().count()
site_configurations_count = SiteConfiguration.objects.all().count()
old_domain = self.request_data.get('credentials_site')
self.request_data['credentials_site'] = 'new.example.credentials'
self.request_data['old_domain_values'] = dict(credentials_site=old_domain)
response = self.client.post(self.edly_sites_url, data=self.request_data, format='json')

assert response.status_code == status.HTTP_200_OK
Expand Down

0 comments on commit 055936a

Please sign in to comment.