Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ecommerce
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
ecommerce
Commits
13590af2
Commit
13590af2
authored
Mar 30, 2018
by
asadiqbal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the link with marketing url from course metadata.
parent
0f82df69
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
2 deletions
+37
-2
ecommerce/extensions/basket/tests/test_views.py
+31
-0
ecommerce/extensions/basket/views.py
+6
-2
No files found.
ecommerce/extensions/basket/tests/test_views.py
View file @
13590af2
...
...
@@ -606,6 +606,37 @@ class BasketSummaryViewTests(EnterpriseServiceMockMixin, DiscoveryTestMixin, Dis
self
.
assertEqual
(
line_data
[
'course_start'
],
expected_result
)
self
.
assertEqual
(
line_data
[
'course_end'
],
expected_result
)
def
test_course_about_url
(
self
):
"""
Test that in case of bulk enrollment, We have the marketing url from course metadata
if present in response.
"""
course_run_info
=
{
"course"
:
"edX+DemoX"
,
"title"
:
'course title here'
,
"short_description"
:
'Foo'
,
"start"
:
"2013-02-05T05:00:00Z"
,
"image"
:
{
"src"
:
"/path/to/image.jpg"
,
},
'enrollment_end'
:
None
,
'marketing_url'
:
'/path/to/marketing/site'
}
self
.
mock_access_token_response
()
course
,
__
,
enrollment_code
=
self
.
prepare_course_seat_and_enrollment_code
()
self
.
create_basket_and_add_product
(
enrollment_code
)
self
.
mock_course_run_detail_endpoint
(
course
,
self
.
site_configuration
.
discovery_api_url
,
course_run_info
)
response
=
self
.
client
.
get
(
self
.
path
)
self
.
assertEqual
(
response
.
status_code
,
200
)
messages
=
list
(
response
.
context
[
'messages'
])
self
.
assertEqual
(
len
(
messages
),
1
)
self
.
assertContains
(
response
,
'/path/to/marketing/site'
,
status_code
=
200
)
def
test_failed_enterprise_consent_sends_message
(
self
):
"""
Test that if we receive an indication via a query parameter that data sharing
...
...
ecommerce/extensions/basket/views.py
View file @
13590af2
...
...
@@ -140,6 +140,7 @@ class BasketSummaryView(BasketView):
short_description
=
None
course_start
=
None
course_end
=
None
course
=
None
try
:
course
=
get_course_info_from_catalog
(
self
.
request
.
site
,
product
)
...
...
@@ -161,7 +162,10 @@ class BasketSummaryView(BasketView):
if
self
.
request
.
basket
.
num_items
==
1
and
product
.
is_enrollment_code_product
:
course_key
=
CourseKey
.
from_string
(
product
.
attr
.
course_key
)
course_about
=
get_lms_course_about_url
(
course_key
=
course_key
)
if
course
and
course
.
get
(
'marketing_url'
,
None
):
course_about_url
=
course
[
'marketing_url'
]
else
:
course_about_url
=
get_lms_course_about_url
(
course_key
=
course_key
)
messages
.
info
(
self
.
request
,
_
(
...
...
@@ -173,7 +177,7 @@ class BasketSummaryView(BasketView):
strong_end
=
'</strong>'
,
paragraph_start
=
'<p>'
,
paragraph_end
=
'</p>'
,
link_start
=
'<a href="{course_about}">'
.
format
(
course_about
=
course_about
),
link_start
=
'<a href="{course_about}">'
.
format
(
course_about
=
course_about
_url
),
link_end
=
'</a>'
),
extra_tags
=
'safe'
...
...
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