Commit 7699b5ff by Renzo Lucioni

Merge pull request #6273 from edx/renzo/fix-shoppingcart-tests

Fix unit test failure due to stale urls.py
parents b4a8302e cdcd5d79
...@@ -1372,7 +1372,7 @@ class CertificateItem(OrderItem): ...@@ -1372,7 +1372,7 @@ class CertificateItem(OrderItem):
if settings.FEATURES.get('SEPARATE_VERIFICATION_FROM_PAYMENT'): if settings.FEATURES.get('SEPARATE_VERIFICATION_FROM_PAYMENT'):
domain = microsite.get_value('SITE_NAME', settings.SITE_NAME) domain = microsite.get_value('SITE_NAME', settings.SITE_NAME)
path = reverse('verify_student_verify_later', args=[unicode(self.course_id)]) path = reverse('verify_student_verify_later', kwargs={'course_id': unicode(self.course_id)})
verification_url = "http://{domain}{path}".format(domain=domain, path=path) verification_url = "http://{domain}{path}".format(domain=domain, path=path)
verification_reminder = _( verification_reminder = _(
......
...@@ -40,6 +40,7 @@ from shoppingcart.exceptions import ( ...@@ -40,6 +40,7 @@ from shoppingcart.exceptions import (
) )
from opaque_keys.edx.locator import CourseLocator from opaque_keys.edx.locator import CourseLocator
from util.testing import UrlResetMixin
# Since we don't need any XML course fixtures, use a modulestore configuration # Since we don't need any XML course fixtures, use a modulestore configuration
# that disables the XML modulestore. # that disables the XML modulestore.
...@@ -48,8 +49,11 @@ MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, incl ...@@ -48,8 +49,11 @@ MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, incl
@override_settings(MODULESTORE=MODULESTORE_CONFIG) @override_settings(MODULESTORE=MODULESTORE_CONFIG)
@ddt.ddt @ddt.ddt
class OrderTest(ModuleStoreTestCase): class OrderTest(UrlResetMixin, ModuleStoreTestCase):
@patch.dict(settings.FEATURES, {'SEPARATE_VERIFICATION_FROM_PAYMENT': True})
def setUp(self): def setUp(self):
super(OrderTest, self).setUp('verify_student.urls')
self.user = UserFactory.create() self.user = UserFactory.create()
course = CourseFactory.create() course = CourseFactory.create()
self.course_key = course.id self.course_key = course.id
...@@ -225,6 +229,7 @@ class OrderTest(ModuleStoreTestCase): ...@@ -225,6 +229,7 @@ class OrderTest(ModuleStoreTestCase):
'STORE_BILLING_INFO': True, 'STORE_BILLING_INFO': True,
} }
) )
@patch.dict(settings.FEATURES, {'SEPARATE_VERIFICATION_FROM_PAYMENT': False})
def test_purchase(self): def test_purchase(self):
# This test is for testing the subclassing functionality of OrderItem, but in # This test is for testing the subclassing functionality of OrderItem, but in
# order to do this, we end up testing the specific functionality of # order to do this, we end up testing the specific functionality of
...@@ -248,7 +253,7 @@ class OrderTest(ModuleStoreTestCase): ...@@ -248,7 +253,7 @@ class OrderTest(ModuleStoreTestCase):
# Assert Google Analytics event fired for purchase. # Assert Google Analytics event fired for purchase.
self.mock_tracker.track.assert_called_once_with( # pylint: disable=maybe-no-member self.mock_tracker.track.assert_called_once_with( # pylint: disable=maybe-no-member
1, self.user.id,
'Completed Order', 'Completed Order',
{ {
'orderId': 1, 'orderId': 1,
...@@ -268,7 +273,6 @@ class OrderTest(ModuleStoreTestCase): ...@@ -268,7 +273,6 @@ class OrderTest(ModuleStoreTestCase):
context={'Google Analytics': {'clientId': None}} context={'Google Analytics': {'clientId': None}}
) )
@patch.dict(settings.FEATURES, {'SEPARATE_VERIFICATION_FROM_PAYMENT': True})
def test_payment_separate_from_verification_email(self): def test_payment_separate_from_verification_email(self):
cart = Order.get_cart_for_user(user=self.user) cart = Order.get_cart_for_user(user=self.user)
item = CertificateItem.add_to_order(cart, self.course_key, self.cost, 'honor') item = CertificateItem.add_to_order(cart, self.course_key, self.cost, 'honor')
......
...@@ -138,7 +138,7 @@ if settings.FEATURES.get("SEPARATE_VERIFICATION_FROM_PAYMENT"): ...@@ -138,7 +138,7 @@ if settings.FEATURES.get("SEPARATE_VERIFICATION_FROM_PAYMENT"):
), ),
# The user has paid and still needs to verify, # The user has paid and still needs to verify,
# but the user is NOT arriving directly from the paymen104ggt flow. # but the user is NOT arriving directly from the payment flow.
# This is equivalent to starting a new flow # This is equivalent to starting a new flow
# with the payment steps and requirements hidden # with the payment steps and requirements hidden
# (since the user already paid). # (since the user already paid).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment