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
cae646a0
Commit
cae646a0
authored
May 10, 2018
by
christopher lee
Committed by
Christopher Lee
May 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor BasketCalculate tests
parent
aad11982
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
57 deletions
+48
-57
ecommerce/extensions/api/v2/tests/views/test_baskets.py
+44
-54
ecommerce/extensions/api/v2/views/baskets.py
+4
-3
No files found.
ecommerce/extensions/api/v2/tests/views/test_baskets.py
View file @
cae646a0
This diff is collapsed.
Click to expand it.
ecommerce/extensions/api/v2/views/baskets.py
View file @
cae646a0
...
...
@@ -436,7 +436,7 @@ class BasketCalculateView(generics.GenericAPIView):
Arguments:
sku (string): A list of sku(s) to calculate
code (string): Optional voucher code to apply to the basket.
username (string): Optional username of a user for which to ca
cl
ulate the basket.
username (string): Optional username of a user for which to ca
lc
ulate the basket.
Returns:
JSON: {
...
...
@@ -468,6 +468,7 @@ class BasketCalculateView(generics.GenericAPIView):
basket_owner
=
request
.
user
requested_username
=
request
.
GET
.
get
(
'username'
,
default
=
''
)
is_anonymous
=
request
.
GET
.
get
(
'is_anonymous'
,
'false'
)
.
lower
()
==
'true'
use_default_basket
=
is_anonymous
# validate query parameters
...
...
@@ -475,8 +476,8 @@ class BasketCalculateView(generics.GenericAPIView):
return
HttpResponseBadRequest
(
_
(
'Provide username or is_anonymous query param, but not both'
))
elif
not
requested_username
and
not
is_anonymous
:
logger
.
warning
(
"Request to Basket Calculate must supply either username or is_anonymous query"
" param. Requesting user=
[
%
s]
. Future versions of this API will treat this "
"WARNING as an ERROR and raise an exception."
)
" param. Requesting user=
%
s
. Future versions of this API will treat this "
"WARNING as an ERROR and raise an exception."
,
basket_owner
.
username
)
# If a username is passed in, validate that the user has staff access or is the same user.
if
requested_username
:
...
...
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