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
f64e79e9
Commit
f64e79e9
authored
Dec 12, 2017
by
Simon Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop syncing course UUID with Drupal page on discovery object edit
EDUCATOR-1957
parent
053467c6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
course_discovery/apps/course_metadata/publishers.py
+3
-1
course_discovery/apps/course_metadata/tests/test_publishers.py
+4
-5
No files found.
course_discovery/apps/course_metadata/publishers.py
View file @
f64e79e9
...
...
@@ -346,6 +346,9 @@ class CourseRunMarketingSitePublisher(BaseMarketingSitePublisher):
self
.
edit_node
(
node_id
,
node_data
)
elif
waffle
.
switch_is_active
(
'auto_course_about_page_creation'
):
node_data
=
self
.
serialize_obj
(
obj
)
# We also want to push the course uuid during creation so the node is sourcing
# course about data from discovery
node_data
.
update
({
'field_course_uuid'
:
str
(
obj
.
uuid
)})
node_id
=
self
.
create_node
(
node_data
)
logger
.
info
(
'Created new marketing site node [
%
s] for course run [
%
s].'
,
node_id
,
obj
.
key
)
self
.
update_node_alias
(
obj
,
node_id
,
previous_obj
)
...
...
@@ -365,7 +368,6 @@ class CourseRunMarketingSitePublisher(BaseMarketingSitePublisher):
return
{
**
data
,
'status'
:
1
if
obj
.
status
==
CourseRunStatus
.
Published
else
0
,
'field_course_uuid'
:
str
(
obj
.
uuid
),
'title'
:
obj
.
title
,
'field_course_id'
:
obj
.
key
,
'type'
:
'course'
,
...
...
course_discovery/apps/course_metadata/tests/test_publishers.py
View file @
f64e79e9
...
...
@@ -214,7 +214,7 @@ class CourseRunMarketingSitePublisherTests(MarketingSitePublisherTestMixin):
mock_node_id
.
assert_called_with
(
self
.
obj
)
assert
not
mock_create_node
.
called
@mock.patch.object
(
CourseRunMarketingSitePublisher
,
'serialize_obj'
,
return_value
=
'data'
)
@mock.patch.object
(
CourseRunMarketingSitePublisher
,
'serialize_obj'
,
return_value
=
{
'data'
:
'test'
}
)
@mock.patch.object
(
CourseRunMarketingSitePublisher
,
'node_id'
,
return_value
=
None
)
@mock.patch.object
(
CourseRunMarketingSitePublisher
,
'create_node'
,
return_value
=
'node_id'
)
@mock.patch.object
(
CourseRunMarketingSitePublisher
,
'update_node_alias'
)
...
...
@@ -226,11 +226,11 @@ class CourseRunMarketingSitePublisherTests(MarketingSitePublisherTestMixin):
):
# pylint: disable=unused-argument
toggle_switch
(
'auto_course_about_page_creation'
,
True
)
self
.
publisher
.
publish_obj
(
self
.
obj
)
mock_create_node
.
assert_called_with
(
'data'
)
mock_create_node
.
assert_called_with
(
{
'data'
:
'test'
,
'field_course_uuid'
:
str
(
self
.
obj
.
uuid
)}
)
mock_update_node_alias
.
assert_called_with
(
self
.
obj
,
'node_id'
,
None
)
@mock.patch.object
(
CourseRunMarketingSitePublisher
,
'node_id'
,
return_value
=
None
)
@mock.patch.object
(
CourseRunMarketingSitePublisher
,
'serialize_obj'
,
return_value
=
'data'
)
@mock.patch.object
(
CourseRunMarketingSitePublisher
,
'serialize_obj'
,
return_value
=
{
'data'
:
'test'
}
)
@mock.patch.object
(
CourseRunMarketingSitePublisher
,
'create_node'
,
return_value
=
'node1'
)
@mock.patch.object
(
CourseRunMarketingSitePublisher
,
'update_node_alias'
)
def
test_publish_obj_create_if_exists_on_discovery
(
...
...
@@ -245,7 +245,7 @@ class CourseRunMarketingSitePublisherTests(MarketingSitePublisherTestMixin):
self
.
publisher
.
publish_obj
(
self
.
obj
,
previous_obj
=
self
.
obj
)
mock_node_id
.
assert_called_with
(
self
.
obj
)
mock_serialize_obj
.
assert_called_with
(
self
.
obj
)
mock_create_node
.
assert_called_with
(
'data'
)
mock_create_node
.
assert_called_with
(
{
'data'
:
'test'
,
'field_course_uuid'
:
str
(
self
.
obj
.
uuid
)}
)
mock_update_node_alias
.
assert_called_with
(
self
.
obj
,
'node1'
,
self
.
obj
)
@mock.patch.object
(
CourseRunMarketingSitePublisher
,
'node_id'
,
return_value
=
'node_id'
)
...
...
@@ -277,7 +277,6 @@ class CourseRunMarketingSitePublisherTests(MarketingSitePublisherTestMixin):
actual
=
self
.
publisher
.
serialize_obj
(
self
.
obj
)
expected
=
{
'field_course_id'
:
self
.
obj
.
key
,
'field_course_uuid'
:
str
(
self
.
obj
.
uuid
),
'title'
:
self
.
obj
.
title
,
'author'
:
{
'id'
:
self
.
user_id
},
'status'
:
1
,
...
...
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