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
925bc682
Commit
925bc682
authored
Feb 08, 2018
by
attiyaishaque
Committed by
Attiya Ishaque
Feb 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Instructor images that can be changed.
parent
de1ec5c8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
8 deletions
+10
-8
course_discovery/apps/api/tests/test_serializers.py
+1
-1
course_discovery/apps/course_metadata/models.py
+4
-6
course_discovery/apps/course_metadata/tests/test_models.py
+5
-1
No files found.
course_discovery/apps/api/tests/test_serializers.py
View file @
925bc682
...
...
@@ -1138,7 +1138,7 @@ class PersonSerializerTests(TestCase):
'family_name'
:
self
.
person
.
family_name
,
'bio'
:
self
.
person
.
bio
,
'profile_image'
:
image_field
.
to_representation
(
self
.
person
.
profile_image
),
'profile_image_url'
:
self
.
person
.
profile_image
_
url
,
'profile_image_url'
:
self
.
person
.
profile_image
.
url
,
'position'
:
PositionSerializer
(
position
)
.
data
,
'works'
:
[
work
.
value
for
work
in
self
.
person
.
person_works
.
all
()],
'urls'
:
{
...
...
course_discovery/apps/course_metadata/models.py
View file @
925bc682
...
...
@@ -298,12 +298,10 @@ class Person(TimeStampedModel):
@property
def
get_profile_image_url
(
self
):
url
=
self
.
profile_image_url
if
not
url
:
if
self
.
profile_image
and
hasattr
(
self
.
profile_image
,
'url'
):
url
=
self
.
profile_image
.
url
return
url
if
self
.
profile_image
and
hasattr
(
self
.
profile_image
,
'url'
):
return
self
.
profile_image
.
url
else
:
return
self
.
profile_image_url
class
Position
(
TimeStampedModel
):
...
...
course_discovery/apps/course_metadata/tests/test_models.py
View file @
925bc682
...
...
@@ -434,12 +434,16 @@ class PersonTests(TestCase):
Verify that property returns profile_image_url if profile_image_url
exists other wise it returns uploaded image url.
"""
self
.
assertEqual
(
self
.
person
.
get_profile_image_url
,
self
.
person
.
profile_image
_
url
)
self
.
assertEqual
(
self
.
person
.
get_profile_image_url
,
self
.
person
.
profile_image
.
url
)
# create another person with out profile_image_url
person
=
factories
.
PersonFactory
(
profile_image_url
=
None
)
self
.
assertEqual
(
person
.
get_profile_image_url
,
person
.
profile_image
.
url
)
# create another person with out profile_image
person
=
factories
.
PersonFactory
(
profile_image
=
None
)
self
.
assertEqual
(
person
.
get_profile_image_url
,
person
.
profile_image_url
)
# create another person with out profile_image_url and profile_image
person
=
factories
.
PersonFactory
(
profile_image_url
=
None
,
profile_image
=
None
)
self
.
assertFalse
(
person
.
get_profile_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