Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx-platform
Commits
ab2dd461
Commit
ab2dd461
authored
Aug 01, 2017
by
Matthew Piatetsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed waffle flag and added test for utm params on redirect
LEARNER-2016
parent
2cdb9de5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
lms/djangoapps/verify_student/tests/test_views.py
+8
-2
lms/djangoapps/verify_student/views.py
+1
-2
No files found.
lms/djangoapps/verify_student/tests/test_views.py
View file @
ab2dd461
...
...
@@ -35,6 +35,7 @@ from course_modes.models import CourseMode
from
course_modes.tests.factories
import
CourseModeFactory
from
lms.djangoapps.verify_student.models
import
SoftwareSecurePhotoVerification
,
VerificationDeadline
from
lms.djangoapps.verify_student.views
import
PayAndVerifyView
,
checkout_with_ecommerce_service
,
render_to_response
from
commerce.utils
import
EcommerceService
from
openedx.core.djangoapps.embargo.test_utils
import
restrict_course
from
openedx.core.djangoapps.theming.tests.test_util
import
with_comprehensive_theme
from
openedx.core.djangoapps.user_api.accounts.api
import
get_account_settings
...
...
@@ -141,12 +142,17 @@ class TestPayAndVerifyView(UrlResetMixin, ModuleStoreTestCase, XssTestMixin):
)
configuration
=
CommerceConfiguration
.
objects
.
create
(
checkout_on_ecommerce_service
=
True
)
checkout_page
=
configuration
.
MULTIPLE_ITEMS_BASKET_PAGE_URL
checkout_page
+=
"?utm_source=test"
httpretty
.
register_uri
(
httpretty
.
GET
,
"{}{}"
.
format
(
TEST_PUBLIC_URL_ROOT
,
checkout_page
))
course
=
self
.
_create_course
(
'verified'
,
sku
=
sku
)
self
.
_enroll
(
course
.
id
)
response
=
self
.
_get_page
(
'verify_student_start_flow'
,
course
.
id
,
expected_status_code
=
302
)
expected_page
=
'{}{}?sku={}'
.
format
(
TEST_PUBLIC_URL_ROOT
,
checkout_page
,
sku
)
# Verify that utm params are included in the url used for redirect
url_with_utm
=
'http://www.example.com/basket/add/?utm_source=test&sku=TESTSKU'
with
mock
.
patch
.
object
(
EcommerceService
,
'get_checkout_page_url'
,
return_value
=
url_with_utm
):
response
=
self
.
_get_page
(
'verify_student_start_flow'
,
course
.
id
,
expected_status_code
=
302
)
expected_page
=
'{}{}&sku={}'
.
format
(
TEST_PUBLIC_URL_ROOT
,
checkout_page
,
sku
)
self
.
assertRedirects
(
response
,
expected_page
,
fetch_redirect_response
=
False
)
@ddt.data
(
...
...
lms/djangoapps/verify_student/views.py
View file @
ab2dd461
...
...
@@ -520,8 +520,7 @@ class PayAndVerifyView(View):
# Redirect if necessary, otherwise implicitly return None
if
url
is
not
None
:
if
waffle
.
switch_is_active
(
'add-utm-params'
):
url
=
self
.
add_utm_params_to_url
(
url
)
url
=
self
.
add_utm_params_to_url
(
url
)
return
redirect
(
url
)
def
_get_paid_mode
(
self
,
course_key
):
...
...
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