PLAT-1863 Fixes for LMS shards 2 and 3 tests under Django 1.9
This commit is contained in:
@@ -250,7 +250,9 @@ def remove_item(request):
|
||||
item_id
|
||||
)
|
||||
else:
|
||||
item = items[0]
|
||||
# Reload the item directly to prevent select_subclasses() hackery from interfering with
|
||||
# deletion of all objects in the model inheritance hierarchy
|
||||
item = items[0].__class__.objects.get(id=item_id)
|
||||
if item.user == request.user:
|
||||
Order.remove_cart_item_from_order(item, request.user)
|
||||
item.order.update_order_type()
|
||||
@@ -395,6 +397,9 @@ def register_code_redemption(request, registration_code):
|
||||
else:
|
||||
for cart_item in cart_items:
|
||||
if isinstance(cart_item, PaidCourseRegistration) or isinstance(cart_item, CourseRegCodeItem):
|
||||
# Reload the item directly to prevent select_subclasses() hackery from interfering with
|
||||
# deletion of all objects in the model inheritance hierarchy
|
||||
cart_item = cart_item.__class__.objects.get(id=cart_item.id)
|
||||
cart_item.delete()
|
||||
|
||||
#now redeem the reg code.
|
||||
|
||||
@@ -47,6 +47,7 @@ from openedx.core.djangoapps.user_api.accounts.api import activate_account, crea
|
||||
from openedx.core.djangolib.js_utils import dump_js_escaped_json
|
||||
from openedx.core.djangolib.markup import HTML, Text
|
||||
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
|
||||
from openedx.tests.util import expected_redirect_url
|
||||
from student.tests.factories import UserFactory
|
||||
from student_account.views import account_settings_context, get_user_orders
|
||||
from third_party_auth.tests.testutil import ThirdPartyAuthTestMixin, simulate_running_pipeline
|
||||
@@ -592,7 +593,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
|
||||
response = self.client.get(reverse(url_name), params, HTTP_ACCEPT="text/html")
|
||||
self.assertRedirects(
|
||||
response,
|
||||
'auth/login/google-oauth2/?auth_entry={}&next=%2Fcourses%2Fsomething%2F%3Ftpa_hint%3Doa2-google-oauth2'.format(auth_entry),
|
||||
expected_redirect_url('auth/login/google-oauth2/?auth_entry={}&next=%2Fcourses%2Fsomething%2F%3Ftpa_hint%3Doa2-google-oauth2'.format(auth_entry)),
|
||||
target_status_code=302
|
||||
)
|
||||
|
||||
@@ -636,7 +637,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
|
||||
response = self.client.get(reverse(url_name), params, HTTP_ACCEPT="text/html")
|
||||
self.assertRedirects(
|
||||
response,
|
||||
'auth/login/google-oauth2/?auth_entry={}&next=%2Fcourses%2Fsomething%2F%3Ftpa_hint%3Doa2-google-oauth2'.format(auth_entry),
|
||||
expected_redirect_url('auth/login/google-oauth2/?auth_entry={}&next=%2Fcourses%2Fsomething%2F%3Ftpa_hint%3Doa2-google-oauth2'.format(auth_entry)),
|
||||
target_status_code=302
|
||||
)
|
||||
|
||||
|
||||
@@ -113,6 +113,7 @@ class RefundSupportView(FormView):
|
||||
"""
|
||||
extra context data to add to page
|
||||
"""
|
||||
kwargs = super(RefundSupportView, self).get_context_data(**kwargs)
|
||||
form = getattr(kwargs['form'], 'cleaned_data', {})
|
||||
if form.get('confirmed') == 'true':
|
||||
kwargs['cert'] = form.get('cert')
|
||||
|
||||
Reference in New Issue
Block a user