Unverified Commit 3951b752 by Brian Mesick Committed by GitHub

Merge pull request #16658 from edx/bmedx/django111_tag_test_failures_lms_3

Tag LMS Unit 3 tests that fail in Django 1.11
parents 56062c0e ace88e7d
......@@ -9,6 +9,7 @@ from datetime import datetime, timedelta
import ddt
import freezegun
import httpretty
import pytest
import pytz
from django.conf import settings
from django.core.urlresolvers import reverse
......@@ -68,6 +69,7 @@ class CourseModeViewTest(CatalogIntegrationMixin, UrlResetMixin, ModuleStoreTest
(False, None, False, False),
)
@ddt.unpack
@pytest.mark.django111_expected_failure
def test_redirect_to_dashboard(self, is_active, enrollment_mode, redirect, has_started):
# Configure whether course has started
# If it has go to course home instead of dashboard
......
......@@ -337,6 +337,7 @@ class TestCourseGrades(TestSubmittingProblems):
@attr(shard=3)
@ddt.ddt
@pytest.mark.django111_expected_failure
class TestCourseGrader(TestSubmittingProblems):
"""
Suite of tests for the course grader.
......
......@@ -4,6 +4,7 @@ Unit tests for instructor_dashboard.py.
import datetime
import ddt
import pytest
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
......@@ -320,6 +321,7 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT
# Max number of student per page is one. Patched setting MAX_STUDENTS_PER_PAGE_GRADE_BOOK = 1
self.assertEqual(len(response.mako_context['students']), 1) # pylint: disable=no-member
@pytest.mark.django111_expected_failure
def test_open_response_assessment_page(self):
"""
Test that Open Responses is available only if course contains at least one ORA block
......@@ -339,6 +341,7 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT
response = self.client.get(self.url)
self.assertIn(ora_section, response.content)
@pytest.mark.django111_expected_failure
def test_open_response_assessment_page_orphan(self):
"""
Tests that the open responses tab loads if the course contains an
......
......@@ -11,6 +11,7 @@ import textwrap
from collections import namedtuple
import ddt
import pytest
from celery.states import FAILURE, SUCCESS
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
......@@ -67,6 +68,7 @@ class TestIntegrationTask(InstructorTaskModuleTestCase):
@attr(shard=3)
@ddt.ddt
@pytest.mark.django111_expected_failure
class TestRescoringTask(TestIntegrationTask):
"""
Integration-style tests for rescoring problems in a background task.
......
......@@ -2,6 +2,7 @@
Tests for the LTI provider views
"""
import pytest
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import RequestFactory
......@@ -163,6 +164,7 @@ class LtiLaunchTest(LtiTestMixin, TestCase):
@attr(shard=3)
@pytest.mark.django111_expected_failure
class LtiLaunchTestRender(LtiTestMixin, RenderXBlockTestMixin, ModuleStoreTestCase):
"""
Tests for the rendering returned by lti_launch view.
......
......@@ -8,6 +8,7 @@ from decimal import Decimal
from urlparse import urlparse
import ddt
import pytest
import pytz
from django.conf import settings
from django.contrib.admin.sites import AdminSite
......@@ -198,7 +199,7 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
self.client.login(username=self.user.username, password="password")
def test_add_course_to_cart_anon(self):
resp = self.client.post(reverse('shoppingcart.views.add_course_to_cart', args=[self.course_key.to_deprecated_string()]))
resp = self.client.post(reverse('add_course_to_cart', args=[self.course_key.to_deprecated_string()]))
self.assertEqual(resp.status_code, 403)
@patch('shoppingcart.views.render_to_response', render_mock)
......@@ -260,7 +261,7 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
self.login_user()
# add first course to user cart
resp = self.client.post(
reverse('shoppingcart.views.add_course_to_cart', args=[self.course_key.to_deprecated_string()])
reverse('add_course_to_cart', args=[self.course_key.to_deprecated_string()])
)
self.assertEqual(resp.status_code, 200)
# add and apply the coupon code to course in the cart
......@@ -273,7 +274,7 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
#now add the second course to cart, the coupon code should be
# applied when adding the second course to the cart
resp = self.client.post(
reverse('shoppingcart.views.add_course_to_cart', args=[self.testing_course.id.to_deprecated_string()])
reverse('add_course_to_cart', args=[self.testing_course.id.to_deprecated_string()])
)
self.assertEqual(resp.status_code, 200)
#now check the user cart and see that the discount has been applied on both the courses
......@@ -286,7 +287,7 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
def test_add_course_to_cart_already_in_cart(self):
PaidCourseRegistration.add_to_order(self.cart, self.course_key)
self.login_user()
resp = self.client.post(reverse('shoppingcart.views.add_course_to_cart', args=[self.course_key.to_deprecated_string()]))
resp = self.client.post(reverse('add_course_to_cart', args=[self.course_key.to_deprecated_string()]))
self.assertEqual(resp.status_code, 400)
self.assertIn('The course {0} is already in your cart.'.format(self.course_key.to_deprecated_string()), resp.content)
......@@ -475,6 +476,7 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
self.assertIn("Cart item quantity should not be greater than 1 when applying activation code", resp.content)
@ddt.data(True, False)
@pytest.mark.django111_expected_failure
def test_reg_code_uses_associated_mode(self, expired_mode):
"""Tests the use of reg codes on verified courses, expired or active. """
course_key = self.course_key.to_deprecated_string()
......@@ -487,6 +489,7 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
self.assertIn(self.course.display_name.encode('utf-8'), resp.content)
@ddt.data(True, False)
@pytest.mark.django111_expected_failure
def test_reg_code_uses_unknown_mode(self, expired_mode):
"""Tests the use of reg codes on verified courses, expired or active. """
course_key = self.course_key.to_deprecated_string()
......@@ -769,20 +772,20 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
def test_add_course_to_cart_already_registered(self):
CourseEnrollment.enroll(self.user, self.course_key)
self.login_user()
resp = self.client.post(reverse('shoppingcart.views.add_course_to_cart', args=[self.course_key.to_deprecated_string()]))
resp = self.client.post(reverse('add_course_to_cart', args=[self.course_key.to_deprecated_string()]))
self.assertEqual(resp.status_code, 400)
self.assertIn('You are already registered in course {0}.'.format(self.course_key.to_deprecated_string()), resp.content)
def test_add_nonexistent_course_to_cart(self):
self.login_user()
resp = self.client.post(reverse('shoppingcart.views.add_course_to_cart', args=['non/existent/course']))
resp = self.client.post(reverse('add_course_to_cart', args=['non/existent/course']))
self.assertEqual(resp.status_code, 404)
self.assertIn("The course you requested does not exist.", resp.content)
def test_add_course_to_cart_success(self):
self.login_user()
reverse('shoppingcart.views.add_course_to_cart', args=[self.course_key.to_deprecated_string()])
resp = self.client.post(reverse('shoppingcart.views.add_course_to_cart', args=[self.course_key.to_deprecated_string()]))
reverse('add_course_to_cart', args=[self.course_key.to_deprecated_string()])
resp = self.client.post(reverse('add_course_to_cart', args=[self.course_key.to_deprecated_string()]))
self.assertEqual(resp.status_code, 200)
self.assertTrue(PaidCourseRegistration.contained_in_order(self.cart, self.course_key))
......@@ -1379,7 +1382,7 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
self._assert_404(reverse('shoppingcart.views.show_cart', args=[]))
self._assert_404(reverse('shoppingcart.views.clear_cart', args=[]))
self._assert_404(reverse('shoppingcart.views.remove_item', args=[]), use_post=True)
self._assert_404(reverse('shoppingcart.views.register_code_redemption', args=["testing"]))
self._assert_404(reverse('register_code_redemption', args=["testing"]))
self._assert_404(reverse('shoppingcart.views.use_code', args=[]), use_post=True)
self._assert_404(reverse('shoppingcart.views.update_user_cart', args=[]))
self._assert_404(reverse('shoppingcart.views.reset_code_redemption', args=[]), use_post=True)
......@@ -1440,6 +1443,7 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
}
)
@pytest.mark.django111_expected_failure
def test_shopping_cart_navigation_link_not_in_microsite(self):
"""
Tests shopping cart link is available in navigation header if request is not from a microsite.
......@@ -1474,6 +1478,7 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
self.assertEqual(resp.status_code, 200)
self.assertIn('<a class="shopping-cart"', resp.content)
@pytest.mark.django111_expected_failure
def test_shopping_cart_navigation_link_in_microsite_courseware_page(self):
"""
Tests shopping cart link is not available in navigation header if request is from a microsite
......
......@@ -8,6 +8,7 @@ from urllib import urlencode
import ddt
import mock
import pytest
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import get_user_model
......@@ -470,6 +471,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
('register_user', 'register'),
)
@ddt.unpack
@pytest.mark.django111_expected_failure
def test_hinted_login_dialog_disabled(self, url_name, auth_entry):
"""Test that the dialog doesn't show up for hinted logins when disabled. """
self.google_provider.skip_hinted_login_dialog = True
......@@ -513,6 +515,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
('register_user', 'register'),
)
@ddt.unpack
@pytest.mark.django111_expected_failure
def test_settings_tpa_hinted_login_dialog_disabled(self, url_name, auth_entry):
"""Test that the dialog doesn't show up for hinted logins when disabled via settings.THIRD_PARTY_AUTH_HINT. """
self.google_provider.skip_hinted_login_dialog = True
......@@ -585,6 +588,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
self.assertEqual(enterprise_cookie.value, '')
@override_settings(SITE_NAME=settings.MICROSITE_TEST_HOSTNAME)
@pytest.mark.django111_expected_failure
def test_microsite_uses_old_login_page(self):
# Retrieve the login page from a microsite domain
# and verify that we're served the old page.
......@@ -595,6 +599,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
self.assertContains(resp, "Log into your Test Site Account")
self.assertContains(resp, "login-form")
@pytest.mark.django111_expected_failure
def test_microsite_uses_old_register_page(self):
# Retrieve the register page from a microsite domain
# and verify that we're served the old page.
......
......@@ -9,6 +9,7 @@ import re
from datetime import datetime, timedelta
import ddt
import pytest
from django.core.urlresolvers import reverse
from django.db.models import signals
from nose.plugins.attrib import attr
......@@ -66,6 +67,7 @@ class SupportViewAccessTests(SupportViewTestCase):
))
))
@ddt.unpack
@pytest.mark.django111_expected_failure
def test_access(self, url_name, role, has_access):
if role is not None:
role().add_users(self.user)
......
......@@ -5,7 +5,10 @@ Tests for Shibboleth Authentication
@jbau
"""
import unittest
from importlib import import_module
from urllib import urlencode
import pytest
from ddt import ddt, data
from django.conf import settings
from django.http import HttpResponseRedirect
......@@ -14,14 +17,12 @@ from django.test.client import RequestFactory, Client as DjangoTestClient
from django.test.utils import override_settings
from django.core.urlresolvers import reverse
from django.contrib.auth.models import AnonymousUser, User
from importlib import import_module
from openedx.core.djangoapps.external_auth.models import ExternalAuthMap
from openedx.core.djangoapps.external_auth.views import (
shib_login, course_specific_login, course_specific_register, _flatten_to_ascii
)
from mock import patch
from nose.plugins.attrib import attr
from urllib import urlencode
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
from student.views import change_enrollment
......@@ -297,6 +298,7 @@ class ShibSPTest(CacheIsolationTestCase):
@unittest.skipUnless(settings.FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set")
@data(*gen_all_identities())
@pytest.mark.django111_expected_failure
def test_registration_form_submit(self, identity):
"""
Tests user creation after the registration form that pops is submitted. If there is no shib
......
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