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
c37181b9
Commit
c37181b9
authored
May 30, 2016
by
Vedran Karačić
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #766 from edx/dynamic-coupon-fixes
Dynamic catalog coupon fixes.
parents
9fd6f149
af181c9b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
8 deletions
+27
-8
ecommerce/coupons/tests/mixins.py
+2
-2
ecommerce/coupons/tests/test_utils.py
+3
-3
ecommerce/coupons/utils.py
+1
-1
ecommerce/extensions/api/v2/views/coupons.py
+1
-1
ecommerce/extensions/offer/migrations/0004_auto_20160530_0944.py
+19
-0
ecommerce/extensions/voucher/tests/test_utils.py
+1
-1
No files found.
ecommerce/coupons/tests/mixins.py
View file @
c37181b9
...
...
@@ -108,8 +108,8 @@ class CouponMixin(object):
catalog(Catalog): Catalog of courses for which the coupon applies
code(str): Custom coupon code
benefit_value(int): The voucher benefit value
catalog_query(str):
c
ourse query string
course_seat_types(
JSONField): L
ist of seat types
catalog_query(str):
C
ourse query string
course_seat_types(
str): A string of comma-separated l
ist of seat types
Returns:
coupon (Coupon)
...
...
ecommerce/coupons/tests/test_utils.py
View file @
c37181b9
...
...
@@ -21,19 +21,19 @@ class CouponUtilsTests(CouponMixin, CourseCatalogTestMixin, CatalogPreviewMockMi
def
setUp
(
self
):
super
(
CouponUtilsTests
,
self
)
.
setUp
()
self
.
query
=
'key:*'
self
.
seat_type
s
=
'verified'
self
.
seat_type
=
'verified'
self
.
course_id
=
'course-v1:test+test+test'
def
test_get_seat_from_query
(
self
):
""" Verify right seat is returned. """
course
,
seat
=
self
.
create_course_and_seat
(
course_id
=
self
.
course_id
)
self
.
mock_dynamic_catalog_course_runs_api
(
query
=
self
.
query
,
course_run
=
course
)
response
=
get_seats_from_query
(
self
.
site
,
self
.
query
,
self
.
seat_type
s
)
response
=
get_seats_from_query
(
self
.
site
,
self
.
query
,
self
.
seat_type
)
self
.
assertEqual
(
seat
,
response
[
0
])
def
test_get_seat_from_query_no_product
(
self
):
""" Verify an empty list is returned for no matched seats. """
course
,
__
=
self
.
create_course_and_seat
(
seat_type
=
'professional'
,
course_id
=
self
.
course_id
)
self
.
mock_dynamic_catalog_course_runs_api
(
query
=
self
.
query
,
course_run
=
course
)
response
=
get_seats_from_query
(
self
.
site
,
self
.
query
,
self
.
seat_type
s
)
response
=
get_seats_from_query
(
self
.
site
,
self
.
query
,
self
.
seat_type
)
self
.
assertEqual
(
response
,
[])
ecommerce/coupons/utils.py
View file @
c37181b9
...
...
@@ -13,7 +13,7 @@ def get_seats_from_query(site, query, seat_types):
Arguments:
site (Site): current site
query (str): course catalog query
seat_types (
JSON): JSON object of accepted seat typ
es
seat_types (
str): a string with comma-separated accepted seat type nam
es
Returns:
List of seat products retrieved from the course catalog query.
...
...
ecommerce/extensions/api/v2/views/coupons.py
View file @
c37181b9
...
...
@@ -174,7 +174,7 @@ class CouponViewSet(EdxOrderPlacementMixin, viewsets.ModelViewSet):
- note (str)
- max_uses (int)
- catalog_query (str)
- course_seat_types (
list of strings
)
- course_seat_types (
str
)
Returns:
A coupon product object.
...
...
ecommerce/extensions/offer/migrations/0004_auto_20160530_0944.py
0 → 100644
View file @
c37181b9
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'offer'
,
'0003_auto_20160517_1247'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'range'
,
name
=
'course_seat_types'
,
field
=
models
.
CharField
(
max_length
=
255
,
null
=
True
,
blank
=
True
),
),
]
ecommerce/extensions/voucher/tests/test_utils.py
View file @
c37181b9
...
...
@@ -357,7 +357,7 @@ class UtilTests(CouponMixin, CourseCatalogTestMixin, LmsApiMockMixin, TestCase):
title
=
'Query coupon'
,
quantity
=
1
,
catalog_query
=
'course:*'
,
course_seat_types
=
{
'verified'
:
1
}
course_seat_types
=
'verified'
)
query_coupon
.
history
.
all
()
.
update
(
history_user
=
self
.
user
)
self
.
mock_course_api_response
(
course
=
self
.
course
)
...
...
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