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
9c4c0383
Commit
9c4c0383
authored
Mar 19, 2018
by
Albert St. Aubin
Committed by
Albert (AJ) St. Aubin
Mar 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Defaulted one_click_purchase_enabled to True
[LEARNER-4061]
parent
d123c957
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
7 deletions
+27
-7
course_discovery/apps/api/v1/tests/test_views/test_programs.py
+6
-6
course_discovery/apps/course_metadata/migrations/0079_enable_program_default_true.py
+20
-0
course_discovery/apps/course_metadata/models.py
+1
-1
No files found.
course_discovery/apps/api/v1/tests/test_views/test_programs.py
View file @
9c4c0383
...
@@ -89,7 +89,7 @@ class TestProgramViewSet(SerializationMixin):
...
@@ -89,7 +89,7 @@ class TestProgramViewSet(SerializationMixin):
def
test_retrieve
(
self
,
django_assert_num_queries
):
def
test_retrieve
(
self
,
django_assert_num_queries
):
""" Verify the endpoint returns the details for a single program. """
""" Verify the endpoint returns the details for a single program. """
program
=
self
.
create_program
()
program
=
self
.
create_program
()
with
django_assert_num_queries
(
47
):
with
django_assert_num_queries
(
56
):
response
=
self
.
assert_retrieve_success
(
program
)
response
=
self
.
assert_retrieve_success
(
program
)
# property does not have the right values while being indexed
# property does not have the right values while being indexed
del
program
.
_course_run_weeks_to_complete
del
program
.
_course_run_weeks_to_complete
...
@@ -115,7 +115,7 @@ class TestProgramViewSet(SerializationMixin):
...
@@ -115,7 +115,7 @@ class TestProgramViewSet(SerializationMixin):
partner
=
self
.
partner
)
partner
=
self
.
partner
)
# property does not have the right values while being indexed
# property does not have the right values while being indexed
del
program
.
_course_run_weeks_to_complete
del
program
.
_course_run_weeks_to_complete
with
django_assert_num_queries
(
3
1
):
with
django_assert_num_queries
(
3
8
):
response
=
self
.
assert_retrieve_success
(
program
)
response
=
self
.
assert_retrieve_success
(
program
)
assert
response
.
data
==
self
.
serialize_program
(
program
)
assert
response
.
data
==
self
.
serialize_program
(
program
)
assert
course_list
==
list
(
program
.
courses
.
all
())
# pylint: disable=no-member
assert
course_list
==
list
(
program
.
courses
.
all
())
# pylint: disable=no-member
...
@@ -124,7 +124,7 @@ class TestProgramViewSet(SerializationMixin):
...
@@ -124,7 +124,7 @@ class TestProgramViewSet(SerializationMixin):
""" Verify the endpoint returns data for a program even if the program's courses have no course runs. """
""" Verify the endpoint returns data for a program even if the program's courses have no course runs. """
course
=
CourseFactory
(
partner
=
self
.
partner
)
course
=
CourseFactory
(
partner
=
self
.
partner
)
program
=
ProgramFactory
(
courses
=
[
course
],
partner
=
self
.
partner
)
program
=
ProgramFactory
(
courses
=
[
course
],
partner
=
self
.
partner
)
with
django_assert_num_queries
(
2
4
):
with
django_assert_num_queries
(
2
5
):
response
=
self
.
assert_retrieve_success
(
program
)
response
=
self
.
assert_retrieve_success
(
program
)
assert
response
.
data
==
self
.
serialize_program
(
program
)
assert
response
.
data
==
self
.
serialize_program
(
program
)
...
@@ -151,7 +151,7 @@ class TestProgramViewSet(SerializationMixin):
...
@@ -151,7 +151,7 @@ class TestProgramViewSet(SerializationMixin):
""" Verify the endpoint returns a list of all programs. """
""" Verify the endpoint returns a list of all programs. """
expected
=
[
self
.
create_program
()
for
__
in
range
(
3
)]
expected
=
[
self
.
create_program
()
for
__
in
range
(
3
)]
expected
.
reverse
()
expected
.
reverse
()
self
.
assert_list_results
(
self
.
list_path
,
expected
,
16
)
self
.
assert_list_results
(
self
.
list_path
,
expected
,
25
)
# Verify that repeated list requests use the cache.
# Verify that repeated list requests use the cache.
self
.
assert_list_results
(
self
.
list_path
,
expected
,
4
)
self
.
assert_list_results
(
self
.
list_path
,
expected
,
4
)
...
@@ -275,13 +275,13 @@ class TestProgramViewSet(SerializationMixin):
...
@@ -275,13 +275,13 @@ class TestProgramViewSet(SerializationMixin):
program
.
marketing_slug
=
SLUG
program
.
marketing_slug
=
SLUG
program
.
save
()
program
.
save
()
self
.
assert_list_results
(
url
,
[
program
],
1
6
)
self
.
assert_list_results
(
url
,
[
program
],
1
9
)
def
test_list_exclude_utm
(
self
):
def
test_list_exclude_utm
(
self
):
""" Verify the endpoint returns marketing URLs without UTM parameters. """
""" Verify the endpoint returns marketing URLs without UTM parameters. """
url
=
self
.
list_path
+
'?exclude_utm=1'
url
=
self
.
list_path
+
'?exclude_utm=1'
program
=
self
.
create_program
()
program
=
self
.
create_program
()
self
.
assert_list_results
(
url
,
[
program
],
1
5
,
extra_context
=
{
'exclude_utm'
:
1
})
self
.
assert_list_results
(
url
,
[
program
],
1
8
,
extra_context
=
{
'exclude_utm'
:
1
})
def
test_minimal_serializer_use
(
self
):
def
test_minimal_serializer_use
(
self
):
""" Verify that the list view uses the minimal serializer. """
""" Verify that the list view uses the minimal serializer. """
...
...
course_discovery/apps/course_metadata/migrations/0079_enable_program_default_true.py
0 → 100644
View file @
9c4c0383
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-03-19 17:18
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'course_metadata'
,
'0078_merge_20180209_1044'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'program'
,
name
=
'one_click_purchase_enabled'
,
field
=
models
.
BooleanField
(
default
=
True
,
help_text
=
'Allow courses in this program to be purchased in a single transaction'
),
),
]
course_discovery/apps/course_metadata/models.py
View file @
9c4c0383
...
@@ -988,7 +988,7 @@ class Program(TimeStampedModel):
...
@@ -988,7 +988,7 @@ class Program(TimeStampedModel):
blank
=
True
,
null
=
True
blank
=
True
,
null
=
True
)
)
one_click_purchase_enabled
=
models
.
BooleanField
(
one_click_purchase_enabled
=
models
.
BooleanField
(
default
=
Fals
e
,
default
=
Tru
e
,
help_text
=
_
(
'Allow courses in this program to be purchased in a single transaction'
)
help_text
=
_
(
'Allow courses in this program to be purchased in a single transaction'
)
)
)
hidden
=
models
.
BooleanField
(
hidden
=
models
.
BooleanField
(
...
...
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