Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
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
course-discovery
Commits
0304d9f7
Commit
0304d9f7
authored
Feb 25, 2018
by
John Eskew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add optional devstack param to whitelabel setup mgmt cmd.
parent
fbdb6d1f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
1 deletions
+43
-1
course_discovery/apps/core/management/commands/create_sites_and_partners.py
+15
-1
course_discovery/apps/core/management/commands/tests/devstack_configuration.json
+16
-0
course_discovery/apps/core/management/commands/tests/test_create_sites_and_partners.py
+12
-0
No files found.
course_discovery/apps/core/management/commands/create_sites_and_partners.py
View file @
0304d9f7
...
...
@@ -19,6 +19,7 @@ class Command(BaseCommand):
"""
dns_name
=
None
theme_path
=
None
configuration_filename
=
None
def
add_arguments
(
self
,
parser
):
parser
.
add_argument
(
...
...
@@ -35,6 +36,12 @@ class Command(BaseCommand):
required
=
True
)
parser
.
add_argument
(
"--devstack"
,
action
=
'store_true'
,
help
=
"Use devstack config, otherwise sandbox config is assumed"
,
)
def
find
(
self
,
pattern
,
path
):
"""
Matches the given pattern in given path and returns the list of matching files.
...
...
@@ -51,7 +58,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 {file_name}"
.
format
(
file_name
=
config_file
))
configuration_data
=
json
.
loads
(
json
.
dumps
(
...
...
@@ -71,9 +78,16 @@ class Command(BaseCommand):
"""
Creates sites and partners.
"""
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: '{dns_name}'"
.
format
(
dns_name
=
self
.
dns_name
))
logger
.
info
(
"Theme path: '{theme_path}'"
.
format
(
theme_path
=
self
.
theme_path
))
...
...
course_discovery/apps/core/management/commands/tests/devstack_configuration.json
0 → 100644
View file @
0304d9f7
{
"discovery_configuration"
:{
"site_domain"
:
"discovery-dummy-{dns_name}.example.com"
,
"site_partner"
:
"dummy"
,
"partner_data"
:
{
"name"
:
"dummy"
,
"oidc_key"
:
"key-dummy"
,
"studio_url"
:
"https://studio-dummy-{dns_name}.example.com"
,
"oidc_secret"
:
"secret-{dns_name}"
,
"oidc_url_root"
:
"https://dummy-{dns_name}.example.com/oauth2"
,
"courses_api_url"
:
"https://dummy-{dns_name}.example.com/api/courses/v1/"
,
"ecommerce_api_url"
:
"https://ecommerce-dummy-{dns_name}.example.com/"
,
"organizations_api_url"
:
"https://dummy-{dns_name}.example.com/api/organizations/v0/"
}
}
}
course_discovery/apps/core/management/commands/tests/test_create_sites_and_partners.py
View file @
0304d9f7
...
...
@@ -78,6 +78,18 @@ class CreateSitesAndPartnersTests(TestCase):
"--theme-path"
,
self
.
theme_path
,
)
def
test_create_devstack_site_and_partner
(
self
):
"""
Verify that command creates sites and Partners for devstack
"""
call_command
(
"create_sites_and_partners"
,
"--dns-name"
,
self
.
dns_name
,
"--theme-path"
,
self
.
theme_path
,
"--devstack"
)
self
.
_assert_site_and_partner_are_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