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
5493dd04
Commit
5493dd04
authored
Dec 01, 2017
by
Simon Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop updating title of the course based on the data from Studio
EDUCATOR-1818
parent
ddee6598
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
7 deletions
+22
-7
course_discovery/apps/course_metadata/data_loaders/api.py
+4
-2
course_discovery/apps/course_metadata/data_loaders/marketing_site.py
+5
-1
course_discovery/apps/course_metadata/data_loaders/tests/test_api.py
+13
-4
No files found.
course_discovery/apps/course_metadata/data_loaders/api.py
View file @
5493dd04
...
...
@@ -112,11 +112,13 @@ class CoursesApiDataLoader(AbstractDataLoader):
try
:
body
=
self
.
clean_strings
(
body
)
course_run
=
self
.
get_course_run
(
body
)
if
course_run
:
self
.
update_course_run
(
course_run
,
body
)
course
=
getattr
(
course_run
,
'canonical_for_course'
,
False
)
if
course
:
if
course
and
not
self
.
partner
.
has_marketing_site
:
# If the partner have marketing site,
# we should only update the course information from the marketing site.
# Therefore, we don't need to do the statements below
course
=
self
.
update_course
(
course
,
body
)
logger
.
info
(
'Processed course with key [
%
s].'
,
course
.
key
)
else
:
...
...
course_discovery/apps/course_metadata/data_loaders/marketing_site.py
View file @
5493dd04
...
...
@@ -372,7 +372,11 @@ class CourseMarketingSiteDataLoader(AbstractMarketingSiteDataLoader):
course
=
self
.
update_course
(
course_run
.
course
,
data
)
self
.
set_subjects
(
course
,
data
)
self
.
set_authoring_organizations
(
course
,
data
)
logger
.
info
(
'Processed course with key [
%
s].'
,
course
.
key
)
logger
.
info
(
'Processed course with key [
%
s] based on the data from courserun [
%
s]'
,
course
.
key
,
course_run
.
key
)
except
AttributeError
:
pass
else
:
...
...
course_discovery/apps/course_metadata/data_loaders/tests/test_api.py
View file @
5493dd04
...
...
@@ -251,7 +251,8 @@ class CoursesApiDataLoaderTests(ApiClientTestMixin, DataLoaderTestMixin, TestCas
mock_logger
.
exception
.
assert_called_with
(
msg
)
@responses.activate
def
test_ingest_canonical
(
self
):
@ddt.data
(
True
,
False
)
def
test_ingest_canonical
(
self
,
partner_has_marketing_site
):
""" Verify the method ingests data from the Courses API. """
self
.
assertEqual
(
Course
.
objects
.
count
(),
0
)
self
.
assertEqual
(
CourseRun
.
objects
.
count
(),
0
)
...
...
@@ -261,6 +262,11 @@ class CoursesApiDataLoaderTests(ApiClientTestMixin, DataLoaderTestMixin, TestCas
mock_data
.
COURSES_API_BODY_SECOND
,
mock_data
.
COURSES_API_BODY_UPDATED
,
])
if
not
partner_has_marketing_site
:
self
.
partner
.
marketing_site_url_root
=
None
self
.
partner
.
save
()
# pylint: disable=no-member
self
.
loader
.
ingest
()
# Verify the CourseRun was created correctly by no errors raised
...
...
@@ -278,8 +284,12 @@ class CoursesApiDataLoaderTests(ApiClientTestMixin, DataLoaderTestMixin, TestCas
# Verify second course not used to update course
self
.
assertNotEqual
(
mock_data
.
COURSES_API_BODY_SECOND
[
'name'
],
course
.
title
)
# Verify udpated canonical course used to update course
self
.
assertEqual
(
mock_data
.
COURSES_API_BODY_UPDATED
[
'name'
],
course
.
title
)
if
partner_has_marketing_site
:
# Verify the course remains unchanged by api update if we have marketing site
self
.
assertEqual
(
mock_data
.
COURSES_API_BODY_ORIGINAL
[
'name'
],
course
.
title
)
else
:
# Verify updated canonical course used to update course
self
.
assertEqual
(
mock_data
.
COURSES_API_BODY_UPDATED
[
'name'
],
course
.
title
)
# Verify the updated course run updated the original course run
self
.
assertEqual
(
mock_data
.
COURSES_API_BODY_UPDATED
[
'hidden'
],
course_run_orig
.
hidden
)
...
...
@@ -466,7 +476,6 @@ class EcommerceApiDataLoaderTests(ApiClientTestMixin, DataLoaderTestMixin, TestC
loaded_seat_data
=
courses_api_data
[:
-
2
]
products_api_data
=
self
.
mock_products_api
()
self
.
assertEqual
(
CourseRun
.
objects
.
count
(),
len
(
loaded_course_run_data
))
# Verify a seat exists on all courses already
...
...
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