Update quality threshold counts (#20681)
This commit is contained in:
@@ -10,7 +10,6 @@ from django.test import TestCase
|
||||
from django.test.client import Client, RequestFactory
|
||||
from django.urls import reverse
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import get_language
|
||||
from six import text_type
|
||||
|
||||
from courseware.access import has_access
|
||||
@@ -173,7 +172,11 @@ class LoginEnrollmentTestCase(TestCase):
|
||||
self.user = self.activate_user(self.email)
|
||||
self.login(self.email, self.password)
|
||||
|
||||
def assert_request_status_code(self, status_code, url, method="GET", **kwargs): # pylint: disable=unicode-format-string
|
||||
def assert_request_status_code(self, status_code, url, method="GET", **kwargs):
|
||||
"""
|
||||
Make a request to the specified URL and verify that it returns the
|
||||
expected status code.
|
||||
"""
|
||||
make_request = getattr(self.client, method.lower())
|
||||
response = make_request(url, **kwargs)
|
||||
self.assertEqual(
|
||||
@@ -192,7 +195,7 @@ class LoginEnrollmentTestCase(TestCase):
|
||||
message_list = list(messages.get_messages(response.wsgi_request))
|
||||
self.assertEqual(len(message_list), 1)
|
||||
self.assertIn("success", message_list[0].tags)
|
||||
self.assertTrue("You have activated your account." in message_list[0].message)
|
||||
self.assertIn("You have activated your account.", message_list[0].message)
|
||||
|
||||
# ============ User creation and login ==============
|
||||
|
||||
@@ -224,7 +227,7 @@ class LoginEnrollmentTestCase(TestCase):
|
||||
'terms_of_service': 'true',
|
||||
'honor_code': 'true',
|
||||
}
|
||||
resp = self.assert_request_status_code(200, url, method="POST", data=request_data)
|
||||
self.assert_request_status_code(200, url, method="POST", data=request_data)
|
||||
# Check both that the user is created, and inactive
|
||||
user = User.objects.get(email=email)
|
||||
self.assertFalse(user.is_active)
|
||||
|
||||
@@ -607,7 +607,6 @@ def answer_entrance_exam_problem(course, request, problem, user=None, value=1, m
|
||||
course,
|
||||
depth=2
|
||||
)
|
||||
# pylint: disable=protected-access
|
||||
module = get_module(
|
||||
user,
|
||||
request,
|
||||
|
||||
@@ -28,7 +28,6 @@ from milestones.tests.utils import MilestonesTestCaseMixin
|
||||
from mock import MagicMock, Mock, patch
|
||||
from opaque_keys.edx.asides import AsideUsageKeyV2
|
||||
from opaque_keys.edx.keys import CourseKey, UsageKey
|
||||
from openedx.core.djangoapps.oauth_dispatch.jwt import create_jwt_for_user
|
||||
from pyquery import PyQuery
|
||||
from six import text_type
|
||||
from web_fragments.fragment import Fragment
|
||||
@@ -59,6 +58,7 @@ from lms.djangoapps.lms_xblock.field_data import LmsFieldData
|
||||
from lms.djangoapps.courseware.field_overrides import OverrideFieldData
|
||||
from openedx.core.djangoapps.credit.api import set_credit_requirement_status, set_credit_requirements
|
||||
from openedx.core.djangoapps.credit.models import CreditCourse
|
||||
from openedx.core.djangoapps.oauth_dispatch.jwt import create_jwt_for_user
|
||||
from openedx.core.lib.courses import course_image_url
|
||||
from openedx.core.lib.gating import api as gating_api
|
||||
from openedx.core.lib.url_utils import quote_slashes
|
||||
@@ -1072,12 +1072,12 @@ class TestTOC(ModuleStoreTestCase):
|
||||
@ddt.ddt
|
||||
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_SPECIAL_EXAMS': True})
|
||||
class TestProctoringRendering(SharedModuleStoreTestCase):
|
||||
"""Check the Table of Contents for a course"""
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(TestProctoringRendering, cls).setUpClass()
|
||||
cls.course_key = ToyCourseFactory.create().id
|
||||
|
||||
"""Check the Table of Contents for a course"""
|
||||
def setUp(self):
|
||||
"""
|
||||
Set up the initial mongo datastores
|
||||
@@ -1408,6 +1408,10 @@ class TestProctoringRendering(SharedModuleStoreTestCase):
|
||||
|
||||
|
||||
class TestGatedSubsectionRendering(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
|
||||
"""
|
||||
Test the toc for a course is rendered correctly when there is gated content
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(TestGatedSubsectionRendering, cls).setUpClass()
|
||||
@@ -1416,9 +1420,6 @@ class TestGatedSubsectionRendering(SharedModuleStoreTestCase, MilestonesTestCase
|
||||
cls.course.save()
|
||||
cls.store.update_item(cls.course, 0)
|
||||
|
||||
"""
|
||||
Test the toc for a course is rendered correctly when there is gated content
|
||||
"""
|
||||
def setUp(self):
|
||||
"""
|
||||
Set up the initial test data
|
||||
@@ -1538,7 +1539,8 @@ class TestHtmlModifiers(ModuleStoreTestCase):
|
||||
)
|
||||
result_fragment = module.render(STUDENT_VIEW)
|
||||
|
||||
self.assertNotIn('div class="xblock xblock-student_view xmodule_display xmodule_HtmlModule"', result_fragment.content)
|
||||
self.assertNotIn('div class="xblock xblock-student_view xmodule_display xmodule_HtmlModule"',
|
||||
result_fragment.content)
|
||||
|
||||
def test_static_link_rewrite(self):
|
||||
module = render.get_module(
|
||||
@@ -2163,7 +2165,7 @@ class TestXmoduleRuntimeEvent(TestSubmittingProblems):
|
||||
field_data_cache = FieldDataCache.cache_for_descriptor_descendents(
|
||||
self.course.id, user, self.course, depth=2)
|
||||
|
||||
return render.get_module( # pylint: disable=protected-access
|
||||
return render.get_module(
|
||||
user,
|
||||
mock_request,
|
||||
self.problem.location,
|
||||
@@ -2236,7 +2238,7 @@ class TestRebindModule(TestSubmittingProblems):
|
||||
if item is None:
|
||||
item = self.lti
|
||||
|
||||
return render.get_module( # pylint: disable=protected-access
|
||||
return render.get_module(
|
||||
user,
|
||||
mock_request,
|
||||
item.location,
|
||||
|
||||
@@ -1922,7 +1922,6 @@ class ProgressPageShowCorrectnessTests(ProgressPageBaseTests):
|
||||
depth=2
|
||||
)
|
||||
self.addCleanup(set_current_request, None)
|
||||
# pylint: disable=protected-access
|
||||
module = get_module(
|
||||
self.user,
|
||||
get_mock_request(self.user),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# pylint: disable=missing-docstring,relative-import
|
||||
# pylint: disable=missing-docstring
|
||||
# This import registers the ForumThreadViewedEventTransformer
|
||||
from __future__ import absolute_import
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
Feature: One-click unsubscribe
|
||||
As a user with notifications enabled
|
||||
I want to be able to unsubscribe from notifications
|
||||
|
||||
Scenario: Unsubscribe when not logged in
|
||||
Given I am an edX user
|
||||
And I am not logged in
|
||||
And I have notifications enabled
|
||||
When I access my unsubscribe url
|
||||
Then my notifications should be disabled
|
||||
And I should see "Unsubscribe Successful!" somewhere on the page
|
||||
And I should see "Click here to return to your dashboard" somewhere on the page
|
||||
And I should see a link to "/dashboard" with the text "here"
|
||||
|
||||
Scenario: Unsubscribe when logged in
|
||||
Given I am a logged in user
|
||||
And I have notifications enabled
|
||||
When I access my unsubscribe url
|
||||
Then my notifications should be disabled
|
||||
And I should see "Unsubscribe Successful!" somewhere on the page
|
||||
And I should see "Click here to return to your dashboard" somewhere on the page
|
||||
And I should see a link to "/dashboard" with the text "here"
|
||||
@@ -1,26 +0,0 @@
|
||||
# pylint: disable=missing-docstring,unused-argument,no-member
|
||||
from django.contrib.auth.models import User
|
||||
from lettuce import step, world
|
||||
|
||||
from lms.djangoapps.discussion.notification_prefs import NOTIFICATION_PREF_KEY
|
||||
from openedx.core.djangoapps.user_api.preferences.api import get_user_preference, set_user_preference
|
||||
|
||||
USERNAME = "robot"
|
||||
UNSUB_TOKEN = "av9E-14sAP1bVBRCPbrTHQ=="
|
||||
|
||||
|
||||
@step(u"I have notifications enabled")
|
||||
def enable_notifications(step_):
|
||||
user = User.objects.get(username=USERNAME)
|
||||
set_user_preference(user, NOTIFICATION_PREF_KEY, UNSUB_TOKEN)
|
||||
|
||||
|
||||
@step(u"I access my unsubscribe url")
|
||||
def access_unsubscribe_url(step_):
|
||||
world.visit("/notification_prefs/unsubscribe/{0}/".format(UNSUB_TOKEN))
|
||||
|
||||
|
||||
@step(u"my notifications should be disabled")
|
||||
def notifications_should_be_disabled(step_):
|
||||
user = User.objects.get(username=USERNAME)
|
||||
assert not get_user_preference(user, NOTIFICATION_PREF_KEY)
|
||||
@@ -76,7 +76,6 @@ def answer_problem(course, request, problem, score=1, max_value=1):
|
||||
course,
|
||||
depth=2
|
||||
)
|
||||
# pylint: disable=protected-access
|
||||
module = get_module(
|
||||
user,
|
||||
request,
|
||||
|
||||
@@ -463,7 +463,8 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
|
||||
|
||||
resp = self.client.post(reverse('shoppingcart.views.use_code'), {'code': self.reg_code})
|
||||
self.assertEqual(resp.status_code, 404)
|
||||
self.assertIn(u"Code '{0}' is not valid for any course in the shopping cart.".format(self.reg_code), resp.content)
|
||||
self.assertIn(u"Code '{0}' is not valid for any course in the shopping cart.".format(self.reg_code),
|
||||
resp.content)
|
||||
|
||||
def test_cart_item_qty_greater_than_1_against_valid_reg_code(self):
|
||||
course_key = text_type(self.course_key)
|
||||
@@ -727,7 +728,7 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
self.assertEquals(self.cart.orderitem_set.count(), 1)
|
||||
info_log.assert_called_with(
|
||||
'Coupon "%s" redemption entry removed for user "%s" for order item "%s"', # pylint: disable=unicode-format-string,line-too-long
|
||||
'Coupon "%s" redemption entry removed for user "%s" for order item "%s"', # pylint: disable=unicode-format-string
|
||||
self.coupon_code,
|
||||
self.user,
|
||||
str(reg_item.id)
|
||||
@@ -740,7 +741,8 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
|
||||
cert_item = CertificateItem.add_to_order(self.cart, self.verified_course_key, self.cost, 'honor')
|
||||
self.assertEquals(self.cart.orderitem_set.count(), 2)
|
||||
|
||||
# Delete the discounted item, corresponding coupon redemption should be removed for that particular discounted item
|
||||
# Delete the discounted item, corresponding coupon redemption
|
||||
# should be removed for that particular discounted item
|
||||
resp = self.client.post(reverse('shoppingcart.views.remove_item', args=[]),
|
||||
{'id': cert_item.id})
|
||||
|
||||
@@ -1253,7 +1255,8 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
|
||||
self.assertIn('FirstNameTesting123', resp.content)
|
||||
self.assertIn('80.00', resp.content)
|
||||
# check for the enrollment codes content
|
||||
self.assertIn('Please send each professional one of these unique registration codes to enroll into the course.', resp.content)
|
||||
self.assertIn('Please send each professional one of these unique registration codes to enroll into the course.',
|
||||
resp.content)
|
||||
|
||||
# fetch the newly generated registration codes
|
||||
course_registration_codes = CourseRegistrationCode.objects.filter(order=self.cart)
|
||||
@@ -2141,7 +2144,9 @@ class CSVReportViewsTest(SharedModuleStoreTestCase):
|
||||
def test_report_csv_bad_date(self):
|
||||
self.login_user()
|
||||
self.add_to_download_group(self.user)
|
||||
response = self.client.post(reverse('payment_csv_report'), {'start_date': 'BAD', 'end_date': 'BAD', 'requested_report': 'itemized_purchase_report'})
|
||||
response = self.client.post(reverse('payment_csv_report'),
|
||||
{'start_date': 'BAD', 'end_date': 'BAD',
|
||||
'requested_report': 'itemized_purchase_report'})
|
||||
|
||||
((template, context), unused_kwargs) = render_mock.call_args
|
||||
self.assertEqual(template, 'shoppingcart/download_report.html')
|
||||
|
||||
Reference in New Issue
Block a user