Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ecommerce
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
ecommerce
Commits
93717b90
Commit
93717b90
authored
Feb 26, 2018
by
John Eskew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add --devstack param to whitelabel setup mgmt cmd.
parent
6badee49
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
1 deletions
+47
-1
ecommerce/theming/management/commands/create_sites_and_partners.py
+15
-1
ecommerce/theming/management/commands/tests/devstack_configuration.json
+20
-0
ecommerce/theming/management/commands/tests/test_create_sites_and_partners.py
+12
-0
No files found.
ecommerce/theming/management/commands/create_sites_and_partners.py
View file @
93717b90
...
...
@@ -23,6 +23,7 @@ class Command(BaseCommand):
help
=
'Creates Sites, SiteThemes, SiteConfigurations and partners.'
dns_name
=
None
theme_path
=
None
configuration_filename
=
None
def
add_arguments
(
self
,
parser
):
parser
.
add_argument
(
...
...
@@ -39,6 +40,12 @@ class Command(BaseCommand):
required
=
True
)
parser
.
add_argument
(
"--devstack"
,
action
=
'store_true'
,
help
=
"Use devstack config, otherwise sandbox config is assumed"
,
)
def
_create_sites
(
self
,
site_domain
,
theme_dir_name
,
site_configuration
,
partner_code
):
"""
Create Sites, SiteThemes and SiteConfigurations
...
...
@@ -85,7 +92,7 @@ class Command(BaseCommand):
Reads the json files from theme directory and returns the site partner data in JSON format.
"""
site_data
=
{}
for
config_file
in
self
.
find
(
'sandbox_configuration.json'
,
self
.
theme_path
):
for
config_file
in
self
.
find
(
self
.
configuration_filename
,
self
.
theme_path
):
logger
.
info
(
'Reading file from
%
s'
,
config_file
)
configuration_data
=
json
.
loads
(
json
.
dumps
(
...
...
@@ -104,9 +111,16 @@ class Command(BaseCommand):
return
site_data
def
handle
(
self
,
*
args
,
**
options
):
if
options
[
'devstack'
]:
configuration_prefix
=
'devstack'
else
:
configuration_prefix
=
'sandbox'
self
.
configuration_filename
=
'{}_configuration.json'
.
format
(
configuration_prefix
)
self
.
dns_name
=
options
[
'dns_name'
]
self
.
theme_path
=
options
[
'theme_path'
]
logger
.
info
(
"Using
%
s configuration..."
,
configuration_prefix
)
logger
.
info
(
'DNS name:
%
s'
,
self
.
dns_name
)
logger
.
info
(
'Theme path:
%
s'
,
self
.
theme_path
)
...
...
ecommerce/theming/management/commands/tests/devstack_configuration.json
0 → 100644
View file @
93717b90
{
"ecommerce_configuration"
:{
"site_partner"
:
"dummy"
,
"theme_dir_name"
:
"dummy.dir"
,
"site_domain"
:
"ecommerce-dummy-{dns_name}.example.com"
,
"configuration"
:
{
"lms_url_root"
:
"https://dummy-{dns_name}.example.com"
,
"payment_processors"
:
"dummy-method"
,
"client_side_payment_processor"
:
"dummy-method"
,
"enable_enrollment_codes"
:
true
,
"oauth_settings"
:
{
"dummy-key"
:
"dummy-value"
},
"payment_support_email"
:
"dummy@example.com"
,
"payment_support_url"
:
"https://dummy-{dns_name}.example.com/contact"
,
"discovery_api_url"
:
"https://discovery-dummy-{dns_name}.example.com/api/v1/"
}
}
}
ecommerce/theming/management/commands/tests/test_create_sites_and_partners.py
View file @
93717b90
...
...
@@ -106,6 +106,18 @@ class TestCreateSitesAndPartners(TestCase):
"--theme-path"
,
self
.
theme_path
,
)
def
test_create_devstack_site_and_partner
(
self
):
"""
Verify that command creates sites and Partners
"""
call_command
(
"create_sites_and_partners"
,
"--dns-name"
,
self
.
dns_name
,
"--theme-path"
,
self
.
theme_path
,
"--devstack"
)
self
.
_assert_sites_data_is_valid
()
def
test_create_site_and_partner
(
self
):
"""
Verify that command creates sites and Partners
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment