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
621dd9ba
Commit
621dd9ba
authored
Jun 23, 2017
by
Simon Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add warning logs to MarketingSitePublisher so we can understand publishing problem better
parent
a93fad99
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
course_discovery/apps/course_metadata/publishers.py
+16
-4
course_discovery/apps/course_metadata/tests/test_publishers.py
+3
-1
No files found.
course_discovery/apps/course_metadata/publishers.py
View file @
621dd9ba
...
...
@@ -102,7 +102,7 @@ class BaseMarketingSitePublisher:
if
response
.
status_code
==
200
:
return
response
.
json
()[
'list'
][
0
][
'nid'
]
else
:
raise
NodeLookupError
raise
NodeLookupError
({
'response_text'
:
response
.
text
,
'response_status'
:
response
.
status_code
})
def
create_node
(
self
,
node_data
):
"""
...
...
@@ -124,7 +124,7 @@ class BaseMarketingSitePublisher:
if
response
.
status_code
==
201
:
return
response
.
json
()[
'id'
]
else
:
raise
NodeCreateError
raise
NodeCreateError
({
'response_text'
:
response
.
text
,
'response_status'
:
response
.
status_code
})
def
edit_node
(
self
,
node_id
,
node_data
):
"""
...
...
@@ -143,7 +143,13 @@ class BaseMarketingSitePublisher:
response
=
self
.
client
.
api_session
.
put
(
node_url
,
data
=
node_data
)
if
response
.
status_code
!=
200
:
raise
NodeEditError
raise
NodeEditError
(
{
'node_id'
:
node_id
,
'response_text'
:
response
.
text
,
'response_status'
:
response
.
status_code
}
)
def
delete_node
(
self
,
node_id
):
"""
...
...
@@ -160,7 +166,13 @@ class BaseMarketingSitePublisher:
response
=
self
.
client
.
api_session
.
delete
(
node_url
)
if
response
.
status_code
!=
200
:
raise
NodeDeleteError
raise
NodeDeleteError
(
{
'node_id'
:
node_id
,
'response_text'
:
response
.
text
,
'response_status'
:
response
.
status_code
}
)
class
CourseRunMarketingSitePublisher
(
BaseMarketingSitePublisher
):
...
...
course_discovery/apps/course_metadata/tests/test_publishers.py
View file @
621dd9ba
...
...
@@ -15,7 +15,9 @@ from course_discovery.apps.course_metadata.exceptions import (
NodeLookupError
)
from
course_discovery.apps.course_metadata.publishers
import
(
BaseMarketingSitePublisher
,
CourseRunMarketingSitePublisher
,
ProgramMarketingSitePublisher
BaseMarketingSitePublisher
,
CourseRunMarketingSitePublisher
,
ProgramMarketingSitePublisher
)
from
course_discovery.apps.course_metadata.tests.factories
import
CourseRunFactory
,
ProgramFactory
from
course_discovery.apps.course_metadata.tests.mixins
import
MarketingSitePublisherTestMixin
...
...
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