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
9b233191
Commit
9b233191
authored
Sep 12, 2016
by
Matthew Piatetsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add uuids to serializers
parent
25f229d7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletions
+13
-1
course_discovery/apps/api/serializers.py
+3
-1
course_discovery/apps/api/tests/test_serializers.py
+10
-0
No files found.
course_discovery/apps/api/serializers.py
View file @
9b233191
...
...
@@ -48,6 +48,7 @@ COURSE_RUN_SEARCH_FIELDS = (
'text'
,
'key'
,
'title'
,
'short_description'
,
'full_description'
,
'start'
,
'end'
,
'enrollment_start'
,
'enrollment_end'
,
'pacing_type'
,
'language'
,
'transcript_languages'
,
'marketing_url'
,
'content_type'
,
'org'
,
'number'
,
'seat_types'
,
'image_url'
,
'type'
,
'level_type'
,
'availability'
,
'published'
,
'partner'
,
'program_types'
,
'authoring_organization_uuids'
,
'subject_uuids'
,
'staff_uuids'
,
)
PROGRAM_FACET_FIELD_OPTIONS
=
{
...
...
@@ -61,7 +62,8 @@ BASE_PROGRAM_FIELDS = (
'published'
,
'partner'
,
)
PROGRAM_SEARCH_FIELDS
=
BASE_PROGRAM_FIELDS
+
(
'authoring_organizations'
,)
PROGRAM_SEARCH_FIELDS
=
BASE_PROGRAM_FIELDS
+
(
'authoring_organizations'
,
'authoring_organization_uuids'
,
'subject_uuids'
,
'staff_uuids'
,)
PROGRAM_FACET_FIELDS
=
BASE_PROGRAM_FIELDS
+
(
'organizations'
,)
...
...
course_discovery/apps/api/tests/test_serializers.py
View file @
9b233191
...
...
@@ -57,6 +57,10 @@ def serialize_language_to_code(language):
return
language
.
code
def
get_uuids
(
items
):
return
[
str
(
item
.
uuid
)
for
item
in
items
]
class
CatalogSerializerTests
(
TestCase
):
def
test_data
(
self
):
user
=
UserFactory
()
...
...
@@ -714,6 +718,9 @@ class CourseRunSearchSerializerTests(TestCase):
'published'
:
course_run
.
status
==
CourseRun
.
Status
.
Published
,
'partner'
:
course_run
.
course
.
partner
.
short_code
,
'program_types'
:
course_run
.
program_types
,
'authoring_organization_uuids'
:
get_uuids
(
course_run
.
authoring_organizations
.
all
()),
'subject_uuids'
:
get_uuids
(
course_run
.
subjects
.
all
()),
'staff_uuids'
:
get_uuids
(
course_run
.
staff
.
all
())
}
self
.
assertDictEqual
(
serializer
.
data
,
expected
)
...
...
@@ -744,6 +751,9 @@ class ProgramSearchSerializerTests(TestCase):
'status'
:
program
.
status
,
'published'
:
program
.
status
==
Program
.
Status
.
Active
,
'partner'
:
program
.
partner
.
short_code
,
'authoring_organization_uuids'
:
get_uuids
(
program
.
authoring_organizations
.
all
()),
'subject_uuids'
:
get_uuids
([
course
.
subjects
for
course
in
program
.
courses
.
all
()]),
'staff_uuids'
:
get_uuids
([
course
.
staff
for
course
in
program
.
course_runs
.
all
()])
}
def
test_data
(
self
):
...
...
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