Python-3: assertNotIn(..response.content) -> assertNotContains
This commit is contained in:
@@ -319,7 +319,7 @@ class AuthTestCase(ContentStoreTestCase):
|
||||
is turned off
|
||||
"""
|
||||
response = self.client.get(reverse('homepage'))
|
||||
self.assertNotIn('<a class="action action-signup" href="/signup">Sign Up</a>', response.content)
|
||||
self.assertNotContains(response, '<a class="action action-signup" href="/signup">Sign Up</a>')
|
||||
|
||||
@mock.patch.dict(settings.FEATURES, {"ALLOW_PUBLIC_ACCOUNT_CREATION": False})
|
||||
def test_signup_button_login_page(self):
|
||||
@@ -328,7 +328,7 @@ class AuthTestCase(ContentStoreTestCase):
|
||||
is turned off
|
||||
"""
|
||||
response = self.client.get(reverse('login'))
|
||||
self.assertNotIn('<a class="action action-signup" href="/signup">Sign Up</a>', response.content)
|
||||
self.assertNotContains(response, '<a class="action action-signup" href="/signup">Sign Up</a>')
|
||||
|
||||
@mock.patch.dict(settings.FEATURES, {"ALLOW_PUBLIC_ACCOUNT_CREATION": False})
|
||||
def test_signup_link_login_page(self):
|
||||
|
||||
@@ -202,15 +202,15 @@ class IndexPageCourseCardsSortingTests(ModuleStoreTestCase):
|
||||
response = self.client.get('/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
# assert that the course discovery UI is not present
|
||||
self.assertNotIn('Search for a course', response.content)
|
||||
self.assertNotContains(response, 'Search for a course')
|
||||
|
||||
# check the /courses view
|
||||
response = self.client.get(reverse('courses'))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# assert that the course discovery UI is not present
|
||||
self.assertNotIn('Search for a course', response.content)
|
||||
self.assertNotIn('<aside aria-label="Refine Your Search" class="search-facets phone-menu">', response.content)
|
||||
self.assertNotContains(response, 'Search for a course')
|
||||
self.assertNotContains(response, '<aside aria-label="Refine Your Search" class="search-facets phone-menu">')
|
||||
|
||||
# make sure we have the special css class on the section
|
||||
self.assertContains(response, '<div class="courses no-course-discovery"')
|
||||
|
||||
@@ -942,14 +942,14 @@ class CertificatesViewsTests(CommonCertificatesTestCase, CacheIsolationTestCase)
|
||||
CourseStaffRole(self.course.id).add_users(self.user)
|
||||
|
||||
response = self.client.get(test_url + '?preview=honor')
|
||||
self.assertNotIn(self.course.display_name.encode('utf-8'), response.content)
|
||||
self.assertNotContains(response, self.course.display_name.encode('utf-8'))
|
||||
self.assertIn('course_title_0', response.content.decode('utf-8'))
|
||||
self.assertIn('Signatory_Title 0', response.content.decode('utf-8'))
|
||||
|
||||
# mark certificate inactive but accessing in preview mode.
|
||||
self._add_course_certificates(count=1, signatory_count=2, is_active=False)
|
||||
response = self.client.get(test_url + '?preview=honor')
|
||||
self.assertNotIn(self.course.display_name.encode('utf-8'), response.content)
|
||||
self.assertNotContains(response, self.course.display_name.encode('utf-8'))
|
||||
self.assertIn('course_title_0', response.content.decode('utf-8'))
|
||||
self.assertIn('Signatory_Title 0', response.content.decode('utf-8'))
|
||||
|
||||
@@ -970,7 +970,7 @@ class CertificatesViewsTests(CommonCertificatesTestCase, CacheIsolationTestCase)
|
||||
# user has already has certificate generated for 'honor' mode
|
||||
# so let's try to preview in 'verified' mode.
|
||||
response = self.client.get(test_url + '?preview=verified')
|
||||
self.assertNotIn(self.course.display_name.encode('utf-8'), response.content)
|
||||
self.assertNotContains(response, self.course.display_name.encode('utf-8'))
|
||||
self.assertIn('course_title_0', response.content.decode('utf-8'))
|
||||
self.assertIn('Signatory_Title 0', response.content.decode('utf-8'))
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class CourseDateSummaryTest(SharedModuleStoreTestCase):
|
||||
self.client.login(username=user.username, password=TEST_PASSWORD)
|
||||
url = reverse('info', args=(course.id,))
|
||||
response = self.client.get(url)
|
||||
self.assertNotIn(b'date-summary', response.content)
|
||||
self.assertNotContains(response, 'date-summary', status_code=302)
|
||||
|
||||
def test_course_home_logged_out(self):
|
||||
course = create_course_run()
|
||||
|
||||
@@ -395,8 +395,8 @@ class ViewsTestCase(ModuleStoreTestCase):
|
||||
)
|
||||
response = self.client.get(url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertNotIn('Problem 1', response.content)
|
||||
self.assertNotIn('Problem 2', response.content)
|
||||
self.assertNotContains(response, 'Problem 1')
|
||||
self.assertNotContains(response, 'Problem 2')
|
||||
|
||||
def _create_global_staff_user(self):
|
||||
"""
|
||||
@@ -467,13 +467,13 @@ class ViewsTestCase(ModuleStoreTestCase):
|
||||
self.client.logout()
|
||||
response = self.client.get(reverse('about_course', args=[six.text_type(course.id)]))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertNotIn(in_cart_span, response.content)
|
||||
self.assertNotContains(response, in_cart_span)
|
||||
|
||||
# authenticated user with nothing in cart
|
||||
self.assertTrue(self.client.login(username=self.user.username, password=TEST_PASSWORD))
|
||||
response = self.client.get(reverse('about_course', args=[six.text_type(course.id)]))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertNotIn(in_cart_span, response.content)
|
||||
self.assertNotContains(response, in_cart_span)
|
||||
|
||||
# now add the course to the cart
|
||||
cart = shoppingcart.models.Order.get_cart_for_user(self.user)
|
||||
@@ -628,7 +628,7 @@ class ViewsTestCase(ModuleStoreTestCase):
|
||||
})
|
||||
response = self.client.get(url)
|
||||
# Tests that we do not get an "Invalid x" response when passing correct arguments to view
|
||||
self.assertNotIn('Invalid', response.content)
|
||||
self.assertNotContains(response, 'Invalid')
|
||||
|
||||
def test_submission_history_xss(self):
|
||||
# log into a staff account
|
||||
@@ -643,7 +643,7 @@ class ViewsTestCase(ModuleStoreTestCase):
|
||||
'location': '<script>alert("hello");</script>'
|
||||
})
|
||||
response = self.client.get(url)
|
||||
self.assertNotIn('<script>', response.content)
|
||||
self.assertNotContains(response, '<script>')
|
||||
|
||||
# try it with a malicious user and a non-existent location
|
||||
url = reverse('submission_history', kwargs={
|
||||
@@ -652,7 +652,7 @@ class ViewsTestCase(ModuleStoreTestCase):
|
||||
'location': 'dummy'
|
||||
})
|
||||
response = self.client.get(url)
|
||||
self.assertNotIn('<script>', response.content)
|
||||
self.assertNotContains(response, '<script>')
|
||||
|
||||
def test_submission_history_contents(self):
|
||||
# log into a staff account
|
||||
@@ -786,7 +786,7 @@ class ViewsTestCase(ModuleStoreTestCase):
|
||||
response = self.client.get(url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
self.assertNotIn(str(course.id), response.content)
|
||||
self.assertNotContains(response, str(course.id))
|
||||
|
||||
@patch.object(CourseOverview, 'load_from_module_store', return_value=None)
|
||||
def test_financial_assistance_form_missing_course_overview(self, _mock_course_overview):
|
||||
@@ -815,7 +815,7 @@ class ViewsTestCase(ModuleStoreTestCase):
|
||||
response = self.client.get(url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
self.assertNotIn(str(course), response.content)
|
||||
self.assertNotContains(response, str(course))
|
||||
|
||||
def test_financial_assistance_form(self):
|
||||
"""Verify that learner can get the financial aid for the course in which
|
||||
@@ -2630,10 +2630,10 @@ class TestIndexViewCompleteOnView(ModuleStoreTestCase, CompletionWaffleTestMixin
|
||||
self.assertTrue(self.client.login(username=self.user.username, password='test'))
|
||||
|
||||
response = self.client.get(self.section_1_url)
|
||||
self.assertNotIn('data-mark-completed-on-view-after-delay', response.content)
|
||||
self.assertNotContains(response, 'data-mark-completed-on-view-after-delay')
|
||||
|
||||
response = self.client.get(self.section_2_url)
|
||||
self.assertNotIn('data-mark-completed-on-view-after-delay', response.content)
|
||||
self.assertNotContains(response, 'data-mark-completed-on-view-after-delay')
|
||||
|
||||
@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
|
||||
def test_completion_service_enabled(self, default_store):
|
||||
@@ -2680,10 +2680,10 @@ class TestIndexViewCompleteOnView(ModuleStoreTestCase, CompletionWaffleTestMixin
|
||||
self.assertEqual(json.loads(response.content.decode('utf-8')), {'result': "ok"})
|
||||
|
||||
response = self.client.get(self.section_1_url)
|
||||
self.assertNotIn('data-mark-completed-on-view-after-delay', response.content)
|
||||
self.assertNotContains(response, 'data-mark-completed-on-view-after-delay')
|
||||
|
||||
response = self.client.get(self.section_2_url)
|
||||
self.assertNotIn('data-mark-completed-on-view-after-delay', response.content)
|
||||
self.assertNotContains(response, 'data-mark-completed-on-view-after-delay')
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
@@ -2906,7 +2906,7 @@ class TestRenderXBlock(RenderXBlockTestMixin, ModuleStoreTestCase, CompletionWaf
|
||||
response = self.get_response(usage_key=self.html_block.location)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, 'data-enable-completion-on-view-service="false"')
|
||||
self.assertNotIn('data-mark-completed-on-view-after-delay', response.content)
|
||||
self.assertNotContains(response, 'data-mark-completed-on-view-after-delay')
|
||||
|
||||
def test_render_xblock_with_completion_service_enabled(self):
|
||||
"""
|
||||
@@ -2940,12 +2940,12 @@ class TestRenderXBlock(RenderXBlockTestMixin, ModuleStoreTestCase, CompletionWaf
|
||||
response = self.get_response(usage_key=self.html_block.location)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, 'data-enable-completion-on-view-service="false"')
|
||||
self.assertNotIn('data-mark-completed-on-view-after-delay', response.content)
|
||||
self.assertNotContains(response, 'data-mark-completed-on-view-after-delay')
|
||||
|
||||
response = self.get_response(usage_key=self.problem_block.location)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, 'data-enable-completion-on-view-service="false"')
|
||||
self.assertNotIn('data-mark-completed-on-view-after-delay', response.content)
|
||||
self.assertNotContains(response, 'data-mark-completed-on-view-after-delay')
|
||||
|
||||
|
||||
class TestRenderXBlockSelfPaced(TestRenderXBlock):
|
||||
|
||||
@@ -73,7 +73,7 @@ class TestECommerceDashboardViews(SiteMixin, SharedModuleStoreTestCase):
|
||||
"""
|
||||
response = self.client.get(self.url)
|
||||
self.assertContains(response, self.ecommerce_link)
|
||||
self.assertNotIn('Create Enrollment Report', response.content)
|
||||
self.assertNotContains(response, 'Create Enrollment Report')
|
||||
|
||||
def test_user_has_finance_admin_rights_in_e_commerce_tab(self):
|
||||
response = self.client.get(self.url)
|
||||
@@ -90,7 +90,7 @@ class TestECommerceDashboardViews(SiteMixin, SharedModuleStoreTestCase):
|
||||
# Order/Invoice sales csv button text should not be visible in e-commerce page if the user is not finance admin
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': text_type(self.course.id)})
|
||||
response = self.client.post(url)
|
||||
self.assertNotIn('Download All Invoices', response.content)
|
||||
self.assertNotContains(response, 'Download All Invoices')
|
||||
|
||||
def test_user_view_course_price(self):
|
||||
"""
|
||||
@@ -105,7 +105,7 @@ class TestECommerceDashboardViews(SiteMixin, SharedModuleStoreTestCase):
|
||||
|
||||
price = course_honor_mode.min_price
|
||||
self.assertContains(response, 'Course price per seat: <span>$' + str(price) + '</span>')
|
||||
self.assertNotIn('+ Set Price</a></span>', response.content)
|
||||
self.assertNotContains(response, '+ Set Price</a></span>')
|
||||
|
||||
# removing the course finance_admin role of login user
|
||||
CourseFinanceAdminRole(self.course.id).remove_users(self.instructor)
|
||||
@@ -113,7 +113,7 @@ class TestECommerceDashboardViews(SiteMixin, SharedModuleStoreTestCase):
|
||||
# total amount should not be visible in e-commerce page if the user is not finance admin
|
||||
url = reverse('instructor_dashboard', kwargs={'course_id': text_type(self.course.id)})
|
||||
response = self.client.get(url)
|
||||
self.assertNotIn('+ Set Price</a></span>', response.content)
|
||||
self.assertNotContains(response, '+ Set Price</a></span>')
|
||||
|
||||
def test_update_course_price_check(self):
|
||||
price = 200
|
||||
@@ -214,7 +214,7 @@ class TestECommerceDashboardViews(SiteMixin, SharedModuleStoreTestCase):
|
||||
response = self.client.post(self.url)
|
||||
self.assertContains(response, '<td>ADSADASDSAD</td>')
|
||||
self.assertContains(response, '<td>A2314</td>')
|
||||
self.assertNotIn('<td>111</td>', response.content)
|
||||
self.assertNotContains(response, '<td>111</td>')
|
||||
|
||||
data = {
|
||||
'code': 'A2345314', 'course_id': text_type(self.course.id),
|
||||
@@ -376,7 +376,7 @@ class TestECommerceDashboardViews(SiteMixin, SharedModuleStoreTestCase):
|
||||
response = self.client.get(self.url)
|
||||
self.assertContains(response, self.ecommerce_link)
|
||||
# Coupons should show up for White Label sites with priced honor modes.
|
||||
self.assertNotIn('Coupons List', response.content)
|
||||
self.assertNotContains(response, 'Coupons List')
|
||||
|
||||
def test_coupon_code_section_not_under_e_commerce_tab(self):
|
||||
"""
|
||||
@@ -388,7 +388,7 @@ class TestECommerceDashboardViews(SiteMixin, SharedModuleStoreTestCase):
|
||||
|
||||
response = self.client.get(self.url)
|
||||
self.assertContains(response, self.ecommerce_link)
|
||||
self.assertNotIn('Coupon Code List', response.content)
|
||||
self.assertNotContains(response, 'Coupon Code List')
|
||||
|
||||
def test_enrollment_codes_section_not_under_e_commerce_tab(self):
|
||||
"""
|
||||
@@ -400,7 +400,7 @@ class TestECommerceDashboardViews(SiteMixin, SharedModuleStoreTestCase):
|
||||
|
||||
response = self.client.get(self.url)
|
||||
self.assertContains(response, self.ecommerce_link)
|
||||
self.assertNotIn('<h3 class="hd hd-3">Enrollment Codes</h3>', response.content)
|
||||
self.assertNotContains(response, '<h3 class="hd hd-3">Enrollment Codes</h3>')
|
||||
|
||||
def test_enrollment_codes_section_visible_for_non_ecommerce_course(self):
|
||||
"""
|
||||
|
||||
@@ -66,7 +66,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(SharedModuleStoreTestCase):
|
||||
BulkEmailFlag.objects.create(enabled=False)
|
||||
# Assert that the URL for the email view is not in the response
|
||||
response = self.client.get(self.url)
|
||||
self.assertNotIn(self.email_link, response.content)
|
||||
self.assertNotContains(response, self.email_link)
|
||||
|
||||
# Flag is enabled, but we require course auth and haven't turned it on for this course
|
||||
def test_course_not_authorized(self):
|
||||
@@ -75,7 +75,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(SharedModuleStoreTestCase):
|
||||
self.assertFalse(is_bulk_email_feature_enabled(self.course.id))
|
||||
# Assert that the URL for the email view is not in the response
|
||||
response = self.client.get(self.url)
|
||||
self.assertNotIn(self.email_link, response.content)
|
||||
self.assertNotContains(response, self.email_link)
|
||||
|
||||
# Flag is enabled, we require course auth and turn it on for this course
|
||||
def test_course_authorized(self):
|
||||
@@ -84,7 +84,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(SharedModuleStoreTestCase):
|
||||
self.assertFalse(is_bulk_email_feature_enabled(self.course.id))
|
||||
# Assert that the URL for the email view is not in the response
|
||||
response = self.client.get(self.url)
|
||||
self.assertNotIn(self.email_link, response.content)
|
||||
self.assertNotContains(response, self.email_link)
|
||||
|
||||
# Authorize the course to use email
|
||||
cauth = CourseAuthorization(course_id=self.course.id, email_enabled=True)
|
||||
@@ -108,7 +108,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(SharedModuleStoreTestCase):
|
||||
self.assertTrue(is_bulk_email_enabled_for_course(self.course.id))
|
||||
# Assert that the URL for the email view IS NOT in the response
|
||||
response = self.client.get(self.url)
|
||||
self.assertNotIn(self.email_link, response.content)
|
||||
self.assertNotContains(response, self.email_link)
|
||||
|
||||
|
||||
class TestNewInstructorDashboardEmailViewXMLBacked(SharedModuleStoreTestCase):
|
||||
@@ -149,10 +149,10 @@ class TestNewInstructorDashboardEmailViewXMLBacked(SharedModuleStoreTestCase):
|
||||
def test_email_flag_true_mongo_false(self):
|
||||
BulkEmailFlag.objects.create(enabled=True, require_course_email_auth=False)
|
||||
response = self.client.get(self.url)
|
||||
self.assertNotIn(self.email_link, response.content)
|
||||
self.assertNotContains(response, self.email_link, status_code=404)
|
||||
|
||||
# The flag is disabled and the course is not Mongo-backed (should not work)
|
||||
def test_email_flag_false_mongo_false(self):
|
||||
BulkEmailFlag.objects.create(enabled=False, require_course_email_auth=False)
|
||||
response = self.client.get(self.url)
|
||||
self.assertNotIn(self.email_link, response.content)
|
||||
self.assertNotContains(response, self.email_link, status_code=404)
|
||||
|
||||
@@ -135,7 +135,7 @@ class TestProctoringDashboardViews(SharedModuleStoreTestCase):
|
||||
self.setup_course(True, True)
|
||||
response = self.client.get(self.url)
|
||||
# the default backend does not support the review dashboard
|
||||
self.assertNotIn('Review Dashboard', response.content)
|
||||
self.assertNotContains(response, 'Review Dashboard')
|
||||
|
||||
backend = TestBackendProvider()
|
||||
config = apps.get_app_config('edx_proctoring')
|
||||
|
||||
@@ -215,7 +215,7 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT
|
||||
staff = StaffFactory(course_key=self.course.id)
|
||||
self.client.login(username=staff.username, password="test")
|
||||
response = self.client.get(self.url)
|
||||
self.assertNotIn('<h4 class="hd hd-4">Adjust all enrolled learners', response.content)
|
||||
self.assertNotContains(response, '<h4 class="hd hd-4">Adjust all enrolled learners')
|
||||
self.assertContains(response, '<h4 class="hd hd-4">View a specific learner's grades and progress')
|
||||
|
||||
@patch(
|
||||
@@ -305,7 +305,7 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT
|
||||
"""
|
||||
response = self.client.get(self.url)
|
||||
# no enrollment information should be visible
|
||||
self.assertNotIn('<h3 class="hd hd-3">Enrollment Information</h3>', response.content)
|
||||
self.assertNotContains(response, '<h3 class="hd hd-3">Enrollment Information</h3>')
|
||||
|
||||
@patch.dict(settings.FEATURES, {'DISPLAY_ANALYTICS_ENROLLMENTS': True})
|
||||
@override_settings(ANALYTICS_DASHBOARD_URL='')
|
||||
@@ -349,10 +349,10 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT
|
||||
response = self.client.get(self.url)
|
||||
|
||||
# enrollment information hidden
|
||||
self.assertNotIn('<th scope="row">Verified</th>', response.content)
|
||||
self.assertNotIn('<th scope="row">Audit</th>', response.content)
|
||||
self.assertNotIn('<th scope="row">Honor</th>', response.content)
|
||||
self.assertNotIn('<th scope="row">Professional</th>', response.content)
|
||||
self.assertNotContains(response, '<th scope="row">Verified</th>')
|
||||
self.assertNotContains(response, '<th scope="row">Audit</th>')
|
||||
self.assertNotContains(response, '<th scope="row">Honor</th>')
|
||||
self.assertNotContains(response, '<th scope="row">Professional</th>')
|
||||
|
||||
# link to dashboard shown
|
||||
expected_message = self.get_dashboard_enrollment_message()
|
||||
@@ -366,7 +366,7 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT
|
||||
"""
|
||||
response = self.client.get(self.url)
|
||||
analytics_section = '<li class="nav-item"><a href="" data-section="instructor_analytics">Analytics</a></li>'
|
||||
self.assertNotIn(analytics_section, response.content)
|
||||
self.assertNotContains(response, analytics_section)
|
||||
|
||||
@override_settings(ANALYTICS_DASHBOARD_URL='http://example.com')
|
||||
@override_settings(ANALYTICS_DASHBOARD_NAME='Example')
|
||||
@@ -479,7 +479,7 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT
|
||||
)
|
||||
|
||||
response = self.client.get(self.url)
|
||||
self.assertNotIn(ora_section, response.content)
|
||||
self.assertNotContains(response, ora_section)
|
||||
|
||||
ItemFactory.create(parent_location=self.course.location, category="openassessment")
|
||||
response = self.client.get(self.url)
|
||||
|
||||
@@ -54,8 +54,8 @@ class TestGlobalAnnouncements(TestCase):
|
||||
def test_feature_flag_disabled(self):
|
||||
"""Ensures that the default settings effectively disables the feature"""
|
||||
response = self.client.get('/dashboard')
|
||||
self.assertNotIn('AnnouncementsView', response.content)
|
||||
self.assertNotIn('<div id="announcements"', response.content)
|
||||
self.assertNotContains(response, 'AnnouncementsView')
|
||||
self.assertNotContains(response, '<div id="announcements"')
|
||||
|
||||
def test_feature_flag_enabled(self):
|
||||
"""Ensures that enabling the flag, enables the feature"""
|
||||
@@ -87,7 +87,7 @@ class TestGlobalAnnouncements(TestCase):
|
||||
"""
|
||||
url = reverse("announcements:page", kwargs={"page": 1})
|
||||
response = self.client.get(url)
|
||||
self.assertNotIn("Inactive Announcement", response.content)
|
||||
self.assertNotContains(response, "Inactive Announcement")
|
||||
|
||||
def test_formatted(self):
|
||||
"""
|
||||
|
||||
@@ -221,7 +221,7 @@ class CourseExpirationTestCase(ModuleStoreTestCase):
|
||||
if show_expiration_banner:
|
||||
self.assertContains(response, banner_text)
|
||||
else:
|
||||
self.assertNotIn(banner_text, response.content)
|
||||
self.assertNotContains(response, banner_text)
|
||||
|
||||
def update_masquerade(self, role='student', group_id=None, username=None, user_partition_id=None):
|
||||
"""
|
||||
@@ -283,7 +283,7 @@ class CourseExpirationTestCase(ModuleStoreTestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
six.assertCountEqual(self, response.redirect_chain, [])
|
||||
banner_text = 'You lose all access to this course, including your progress,'
|
||||
self.assertNotIn(banner_text, response.content)
|
||||
self.assertNotContains(response, banner_text)
|
||||
|
||||
@mock.patch("openedx.features.course_duration_limits.access.get_course_run_details")
|
||||
def test_masquerade_expired(self, mock_get_course_run_details):
|
||||
@@ -370,7 +370,7 @@ class CourseExpirationTestCase(ModuleStoreTestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
six.assertCountEqual(self, response.redirect_chain, [])
|
||||
banner_text = 'This learner does not have access to this course. Their access expired on'
|
||||
self.assertNotIn(banner_text, response.content)
|
||||
self.assertNotContains(response, banner_text)
|
||||
|
||||
@mock.patch("openedx.features.course_duration_limits.access.get_course_run_details")
|
||||
@ddt.data(
|
||||
@@ -419,4 +419,4 @@ class CourseExpirationTestCase(ModuleStoreTestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
six.assertCountEqual(self, response.redirect_chain, [])
|
||||
banner_text = 'This learner does not have access to this course. Their access expired on'
|
||||
self.assertNotIn(banner_text, response.content)
|
||||
self.assertNotContains(response, banner_text)
|
||||
|
||||
@@ -962,7 +962,7 @@ class CourseHomeFragmentViewTests(ModuleStoreTestCase):
|
||||
|
||||
def assert_upgrade_message_not_displayed(self):
|
||||
response = self.client.get(self.url)
|
||||
self.assertNotIn('section-upgrade', response.content)
|
||||
self.assertNotContains(response, 'section-upgrade')
|
||||
|
||||
def assert_upgrade_message_displayed(self):
|
||||
response = self.client.get(self.url)
|
||||
|
||||
Reference in New Issue
Block a user