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
746aab5e
Commit
746aab5e
authored
Nov 10, 2016
by
tasawernawaz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating course video source field
parent
698eb202
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
+11
-1
course_discovery/apps/course_metadata/data_loaders/marketing_site.py
+2
-1
course_discovery/apps/course_metadata/data_loaders/tests/test_marketing_site.py
+9
-0
No files found.
course_discovery/apps/course_metadata/data_loaders/marketing_site.py
View file @
746aab5e
...
...
@@ -430,7 +430,7 @@ class CourseMarketingSiteDataLoader(AbstractMarketingSiteDataLoader):
return
level_type
def
get_video
(
self
,
data
):
video_url
=
self
.
_get_nested_url
(
data
.
get
(
'field_product_video'
))
video_url
=
self
.
_get_nested_url
(
data
.
get
(
'field_
course_video'
)
or
data
.
get
(
'field_
product_video'
))
image_url
=
self
.
_get_nested_url
(
data
.
get
(
'field_course_image_featured_card'
))
return
self
.
get_or_create_video
(
video_url
,
image_url
)
...
...
@@ -469,6 +469,7 @@ class CourseMarketingSiteDataLoader(AbstractMarketingSiteDataLoader):
'hidden'
:
self
.
get_hidden
(
data
),
'weeks_to_complete'
:
None
,
'mobile_available'
:
data
.
get
(
'field_course_enrollment_mobile'
)
or
False
,
'video'
:
course
.
video
,
}
if
weeks_to_complete
:
...
...
course_discovery/apps/course_metadata/data_loaders/tests/test_marketing_site.py
View file @
746aab5e
...
...
@@ -397,9 +397,18 @@ class CourseMarketingSiteDataLoaderTests(AbstractMarketingSiteDataLoaderTestMixi
self
.
assertEqual
(
self
.
loader
.
get_description
(
data
),
'Test'
)
def
test_get_video
(
self
):
"""Verify that method gets video from any of 'field_course_video' or 'field_product_video.'"""
image_url
=
'https://example.com/image.jpg'
video_url
=
'https://example.com/video.mp4'
data
=
{
'field_course_video'
:
{
'url'
:
video_url
},
'field_course_image_featured_card'
:
{
'url'
:
image_url
}
}
video
=
self
.
loader
.
get_video
(
data
)
self
.
assertEqual
(
video
.
src
,
video_url
)
self
.
assertEqual
(
video
.
image
.
src
,
image_url
)
data
=
{
'field_product_video'
:
{
'url'
:
video_url
},
'field_course_image_featured_card'
:
{
'url'
:
image_url
}
}
...
...
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