From cdcd5d79fea51733a09c2d12f8f58e8d1ca147d3 Mon Sep 17 00:00:00 2001 From: Renzo Lucioni Date: Tue, 16 Dec 2014 12:08:20 -0500 Subject: [PATCH] Fix unit test failure due to stale urls.py --- lms/djangoapps/shoppingcart/models.py | 2 +- lms/djangoapps/shoppingcart/tests/test_models.py | 10 +++++++--- lms/djangoapps/verify_student/urls.py | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lms/djangoapps/shoppingcart/models.py b/lms/djangoapps/shoppingcart/models.py index 8615616c60..f45fc08830 100644 --- a/lms/djangoapps/shoppingcart/models.py +++ b/lms/djangoapps/shoppingcart/models.py @@ -1372,7 +1372,7 @@ class CertificateItem(OrderItem): if settings.FEATURES.get('SEPARATE_VERIFICATION_FROM_PAYMENT'): 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_reminder = _( diff --git a/lms/djangoapps/shoppingcart/tests/test_models.py b/lms/djangoapps/shoppingcart/tests/test_models.py index a46a7127bd..a825e4aff5 100644 --- a/lms/djangoapps/shoppingcart/tests/test_models.py +++ b/lms/djangoapps/shoppingcart/tests/test_models.py @@ -40,6 +40,7 @@ from shoppingcart.exceptions import ( ) 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 # that disables the XML modulestore. @@ -48,8 +49,11 @@ MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, incl @override_settings(MODULESTORE=MODULESTORE_CONFIG) @ddt.ddt -class OrderTest(ModuleStoreTestCase): +class OrderTest(UrlResetMixin, ModuleStoreTestCase): + @patch.dict(settings.FEATURES, {'SEPARATE_VERIFICATION_FROM_PAYMENT': True}) def setUp(self): + super(OrderTest, self).setUp('verify_student.urls') + self.user = UserFactory.create() course = CourseFactory.create() self.course_key = course.id @@ -225,6 +229,7 @@ class OrderTest(ModuleStoreTestCase): 'STORE_BILLING_INFO': True, } ) + @patch.dict(settings.FEATURES, {'SEPARATE_VERIFICATION_FROM_PAYMENT': False}) def test_purchase(self): # This test is for testing the subclassing functionality of OrderItem, but in # order to do this, we end up testing the specific functionality of @@ -248,7 +253,7 @@ class OrderTest(ModuleStoreTestCase): # Assert Google Analytics event fired for purchase. self.mock_tracker.track.assert_called_once_with( # pylint: disable=maybe-no-member - 1, + self.user.id, 'Completed Order', { 'orderId': 1, @@ -268,7 +273,6 @@ class OrderTest(ModuleStoreTestCase): context={'Google Analytics': {'clientId': None}} ) - @patch.dict(settings.FEATURES, {'SEPARATE_VERIFICATION_FROM_PAYMENT': True}) def test_payment_separate_from_verification_email(self): cart = Order.get_cart_for_user(user=self.user) item = CertificateItem.add_to_order(cart, self.course_key, self.cost, 'honor') diff --git a/lms/djangoapps/verify_student/urls.py b/lms/djangoapps/verify_student/urls.py index d3470ee2b1..d9db334d36 100644 --- a/lms/djangoapps/verify_student/urls.py +++ b/lms/djangoapps/verify_student/urls.py @@ -138,7 +138,7 @@ if settings.FEATURES.get("SEPARATE_VERIFICATION_FROM_PAYMENT"): ), # 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 # with the payment steps and requirements hidden # (since the user already paid).