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
89296271
Commit
89296271
authored
Oct 03, 2016
by
Vedran Karacic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disallow showing the note about verified certificate in baskets with credit seats.
parent
cd2a7cd0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletions
+25
-1
ecommerce/extensions/basket/tests/test_views.py
+23
-0
ecommerce/extensions/basket/views.py
+2
-1
No files found.
ecommerce/extensions/basket/tests/test_views.py
View file @
89296271
...
@@ -42,6 +42,7 @@ Basket = get_model('basket', 'Basket')
...
@@ -42,6 +42,7 @@ Basket = get_model('basket', 'Basket')
Benefit
=
get_model
(
'offer'
,
'Benefit'
)
Benefit
=
get_model
(
'offer'
,
'Benefit'
)
Catalog
=
get_model
(
'catalogue'
,
'Catalog'
)
Catalog
=
get_model
(
'catalogue'
,
'Catalog'
)
Product
=
get_model
(
'catalogue'
,
'Product'
)
Product
=
get_model
(
'catalogue'
,
'Product'
)
ProductAttribute
=
get_model
(
'catalogue'
,
'ProductAttribute'
)
Selector
=
get_class
(
'partner.strategy'
,
'Selector'
)
Selector
=
get_class
(
'partner.strategy'
,
'Selector'
)
StockRecord
=
get_model
(
'partner'
,
'StockRecord'
)
StockRecord
=
get_model
(
'partner'
,
'StockRecord'
)
Voucher
=
get_model
(
'voucher'
,
'Voucher'
)
Voucher
=
get_model
(
'voucher'
,
'Voucher'
)
...
@@ -428,6 +429,28 @@ class BasketSummaryViewTests(CourseCatalogTestMixin, CourseCatalogMockMixin, Lms
...
@@ -428,6 +429,28 @@ class BasketSummaryViewTests(CourseCatalogTestMixin, CourseCatalogMockMixin, Lms
self
.
assertEqual
(
line_data
.
get
(
'image_url'
),
''
)
self
.
assertEqual
(
line_data
.
get
(
'image_url'
),
''
)
self
.
assertEqual
(
line_data
.
get
(
'course_short_description'
),
None
)
self
.
assertEqual
(
line_data
.
get
(
'course_short_description'
),
None
)
@ddt.data
(
(
'verified'
,
True
),
(
'credit'
,
False
)
)
@ddt.unpack
def
test_verification_message
(
self
,
cert_type
,
ver_req
):
""" Verify the variable for verification requirement is False for credit seats. """
seat
=
self
.
create_seat
(
self
.
course
,
cert_type
=
cert_type
)
self
.
create_basket_and_add_product
(
seat
)
response
=
self
.
client
.
get
(
self
.
path
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
context
[
'is_verification_required'
],
ver_req
)
def
test_verification_attribute_missing
(
self
):
""" Verify the variable for verification requirement is False when the attribute is missing. """
seat
=
self
.
create_seat
(
self
.
course
)
ProductAttribute
.
objects
.
filter
(
name
=
'id_verification_required'
)
.
delete
()
self
.
create_basket_and_add_product
(
seat
)
response
=
self
.
client
.
get
(
self
.
path
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
context
[
'is_verification_required'
],
False
)
class
VoucherAddMessagesViewTests
(
TestCase
):
class
VoucherAddMessagesViewTests
(
TestCase
):
""" VoucherAddMessagesView view tests. """
""" VoucherAddMessagesView view tests. """
...
...
ecommerce/extensions/basket/views.py
View file @
89296271
...
@@ -151,7 +151,8 @@ class BasketSummaryView(BasketView):
...
@@ -151,7 +151,8 @@ class BasketSummaryView(BasketView):
# Check product attributes to determine if ID verification is required for this basket
# Check product attributes to determine if ID verification is required for this basket
try
:
try
:
is_verification_required
=
is_verification_required
or
line
.
product
.
attr
.
id_verification_required
is_verification_required
=
line
.
product
.
attr
.
id_verification_required
\
and
line
.
product
.
attr
.
certificate_type
!=
'credit'
except
AttributeError
:
except
AttributeError
:
pass
pass
...
...
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