Python 3: multi-lined assertIn, assertNotIn -> assertContains, assertNotContains
This commit is contained in:
@@ -93,8 +93,7 @@ class TestCourseListing(ModuleStoreTestCase):
|
||||
"""
|
||||
message = u"Are you staff on an existing {studio_name} course?".format(studio_name=settings.STUDIO_SHORT_NAME)
|
||||
response = self.client.get('/home')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn(message, response.content.decode(response.charset))
|
||||
self.assertContains(response, message)
|
||||
|
||||
def test_get_course_list(self):
|
||||
"""
|
||||
|
||||
@@ -65,19 +65,17 @@ class TestExportGit(CourseTestCase):
|
||||
if course hasn't set giturl.
|
||||
"""
|
||||
response = self.client.get(self.test_url)
|
||||
self.assertEqual(200, response.status_code)
|
||||
self.assertIn(
|
||||
self.assertContains(
|
||||
response,
|
||||
('giturl must be defined in your '
|
||||
'course settings before you can export to git.'),
|
||||
response.content.decode('utf-8')
|
||||
)
|
||||
|
||||
response = self.client.get('{}?action=push'.format(self.test_url))
|
||||
self.assertEqual(200, response.status_code)
|
||||
self.assertIn(
|
||||
self.assertContains(
|
||||
response,
|
||||
('giturl must be defined in your '
|
||||
'course settings before you can export to git.'),
|
||||
response.content.decode('utf-8')
|
||||
)
|
||||
|
||||
def test_course_export_failures(self):
|
||||
|
||||
@@ -781,10 +781,11 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Verify that course video button is present in the response if videos transcript feature is enabled.
|
||||
self.assertEqual(
|
||||
'<button class="button course-video-settings-button">' in response.content.decode('utf-8'),
|
||||
is_video_transcript_enabled
|
||||
)
|
||||
button_html = '<button class="button course-video-settings-button">'
|
||||
if is_video_transcript_enabled:
|
||||
self.assertContains(response, button_html)
|
||||
else:
|
||||
self.assertNotContains(response, button_html)
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
|
||||
@@ -315,4 +315,4 @@ class TestIndex(SiteMixin, TestCase):
|
||||
self.use_site(self.site_other)
|
||||
self.client.login(username=self.user.username, password="password")
|
||||
response = self.client.get(reverse("dashboard"))
|
||||
self.assertContains(response, self.site_configuration_other.values["MKTG_URLS"]["ROOT"])
|
||||
self.assertIn(self.site_configuration_other.values["MKTG_URLS"]["ROOT"], response.content.decode('utf-8'))
|
||||
|
||||
@@ -349,10 +349,10 @@ class BulkEnrollmentTest(ModuleStoreTestCase, LoginEnrollmentTestCase, APITestCa
|
||||
'courses': self.course_key,
|
||||
'cohorts': "cohort1,cohort2"
|
||||
})
|
||||
self.assertEqual(response.status_code, 400)
|
||||
self.assertIn(
|
||||
self.assertContains(
|
||||
response,
|
||||
'If provided, the cohorts and courses should have equal number of items.',
|
||||
response.content.decode('utf-8')
|
||||
status_code=400,
|
||||
)
|
||||
|
||||
def test_fail_on_missing_cohorts(self):
|
||||
@@ -366,10 +366,13 @@ class BulkEnrollmentTest(ModuleStoreTestCase, LoginEnrollmentTestCase, APITestCa
|
||||
'cohorts': 'cohort1',
|
||||
'courses': self.course_key
|
||||
})
|
||||
self.assertEqual(response.status_code, 400)
|
||||
self.assertIn(u'cohort {cohort_name} not found in course {course_id}.'.format(
|
||||
cohort_name='cohort1', course_id=self.course_key
|
||||
), response.content.decode('utf-8'))
|
||||
self.assertContains(
|
||||
response,
|
||||
u'cohort {cohort_name} not found in course {course_id}.'.format(
|
||||
cohort_name='cohort1', course_id=self.course_key
|
||||
),
|
||||
status_code=400,
|
||||
)
|
||||
|
||||
def test_allow_cohorts_when_enrolling(self):
|
||||
"""
|
||||
|
||||
@@ -289,11 +289,13 @@ class CertificatesViewsSiteTests(ModuleStoreTestCase):
|
||||
)
|
||||
self._add_course_certificates(count=1, signatory_count=2)
|
||||
response = self.client.get(test_url)
|
||||
self.assertIn(
|
||||
'awarded this My Platform Site Honor Code Certificate of Completion', response.content.decode('utf-8')
|
||||
self.assertContains(
|
||||
response,
|
||||
'awarded this My Platform Site Honor Code Certificate of Completion',
|
||||
)
|
||||
self.assertIn(
|
||||
'My Platform Site offers interactive online classes and MOOCs.', response.content.decode('utf-8')
|
||||
self.assertContains(
|
||||
response,
|
||||
'My Platform Site offers interactive online classes and MOOCs.'
|
||||
)
|
||||
self.assertContains(response, 'About My Platform Site')
|
||||
|
||||
@@ -307,6 +309,7 @@ class CertificatesViewsSiteTests(ModuleStoreTestCase):
|
||||
response = self.client.get(test_url)
|
||||
self.assertContains(response, 'edX')
|
||||
self.assertNotContains(response, 'My Platform Site')
|
||||
self.assertNotIn(
|
||||
'This should not survive being overwritten by static content', response.content.decode('utf-8')
|
||||
self.assertNotContains(
|
||||
response,
|
||||
'This should not survive being overwritten by static content',
|
||||
)
|
||||
|
||||
@@ -273,9 +273,9 @@ class CertificatesViewsTests(CommonCertificatesTestCase, CacheIsolationTestCase)
|
||||
).encode('utf-8'),),
|
||||
('pfCertificationUrl', self.request.build_absolute_uri(test_url),),
|
||||
])
|
||||
self.assertIn(
|
||||
self.assertContains(
|
||||
response,
|
||||
js_escaped_string(self.linkedin_url.format(params=urlencode(params))),
|
||||
response.content.decode('utf-8')
|
||||
)
|
||||
|
||||
@override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED)
|
||||
@@ -300,9 +300,9 @@ class CertificatesViewsTests(CommonCertificatesTestCase, CacheIsolationTestCase)
|
||||
).encode('utf-8'),),
|
||||
('pfCertificationUrl', 'http://test.localhost' + test_url,),
|
||||
])
|
||||
self.assertIn(
|
||||
self.assertContains(
|
||||
response,
|
||||
js_escaped_string(self.linkedin_url.format(params=urlencode(params))),
|
||||
response.content.decode('utf-8')
|
||||
)
|
||||
|
||||
@override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED)
|
||||
@@ -414,20 +414,13 @@ class CertificatesViewsTests(CommonCertificatesTestCase, CacheIsolationTestCase)
|
||||
course_id=six.text_type(self.course.id)
|
||||
)
|
||||
response = self.client.get(test_url)
|
||||
content = response.content.decode(response.charset)
|
||||
self.assertIn(
|
||||
self.assertContains(
|
||||
response,
|
||||
'a course of study offered by test_organization, an online learning initiative of test organization',
|
||||
content
|
||||
)
|
||||
self.assertNotIn(
|
||||
'a course of study offered by testorg',
|
||||
content
|
||||
)
|
||||
self.assertIn(
|
||||
u'<title>test_organization {} Certificate |'.format(self.course.number, ),
|
||||
content
|
||||
)
|
||||
self.assertIn('logo_test1.png', content)
|
||||
self.assertNotContains(response, 'a course of study offered by testorg')
|
||||
self.assertContains(response, u'<title>test_organization {} Certificate |'.format(self.course.number, ))
|
||||
self.assertContains(response, 'logo_test1.png')
|
||||
|
||||
@ddt.data(True, False)
|
||||
@patch('lms.djangoapps.certificates.views.webview.get_completion_badge')
|
||||
@@ -503,63 +496,33 @@ class CertificatesViewsTests(CommonCertificatesTestCase, CacheIsolationTestCase)
|
||||
response = self.client.get(test_url, HTTP_HOST='test.localhost')
|
||||
|
||||
# Test an item from basic info
|
||||
self.assertIn(
|
||||
'Terms of Service & Honor Code',
|
||||
response.content.decode('utf-8')
|
||||
)
|
||||
self.assertIn(
|
||||
'Certificate ID Number',
|
||||
response.content.decode('utf-8')
|
||||
)
|
||||
self.assertContains(response, 'Terms of Service & Honor Code')
|
||||
self.assertContains(response, 'Certificate ID Number')
|
||||
# Test an item from html cert configuration
|
||||
self.assertIn(
|
||||
'<a class="logo" href="http://test_site.localhost">',
|
||||
response.content.decode('utf-8')
|
||||
)
|
||||
self.assertContains(response, '<a class="logo" href="http://test_site.localhost">')
|
||||
# Test an item from course info
|
||||
self.assertIn(
|
||||
'course_title_0',
|
||||
response.content.decode('utf-8')
|
||||
)
|
||||
self.assertContains(response, 'course_title_0')
|
||||
# Test an item from user info
|
||||
self.assertIn(
|
||||
u"{fullname}, you earned a certificate!".format(fullname=self.user.profile.name),
|
||||
response.content.decode('utf-8')
|
||||
)
|
||||
self.assertContains(response, u"{fullname}, you earned a certificate!".format(fullname=self.user.profile.name))
|
||||
# Test an item from social info
|
||||
self.assertIn(
|
||||
"Post on Facebook",
|
||||
response.content.decode('utf-8')
|
||||
)
|
||||
self.assertIn(
|
||||
"Share on Twitter",
|
||||
response.content.decode('utf-8')
|
||||
)
|
||||
self.assertContains(response, "Post on Facebook")
|
||||
self.assertContains(response, "Share on Twitter")
|
||||
# Test an item from certificate/org info
|
||||
self.assertIn(
|
||||
self.assertContains(
|
||||
response,
|
||||
u"a course of study offered by {partner_short_name}, "
|
||||
"an online learning initiative of "
|
||||
"{partner_long_name}.".format(
|
||||
partner_short_name=short_org_name,
|
||||
partner_long_name=long_org_name,
|
||||
),
|
||||
response.content.decode('utf-8')
|
||||
)
|
||||
# Test item from badge info
|
||||
self.assertIn(
|
||||
"Add to Mozilla Backpack",
|
||||
response.content.decode('utf-8')
|
||||
)
|
||||
self.assertContains(response, "Add to Mozilla Backpack")
|
||||
# Test item from site configuration
|
||||
self.assertIn(
|
||||
"http://www.test-site.org/about-us",
|
||||
response.content.decode('utf-8')
|
||||
)
|
||||
self.assertContains(response, "http://www.test-site.org/about-us")
|
||||
# Test course overrides
|
||||
self.assertIn(
|
||||
"/static/certificates/images/course_override_logo.png",
|
||||
response.content.decode('utf-8')
|
||||
)
|
||||
self.assertContains(response, "/static/certificates/images/course_override_logo.png")
|
||||
|
||||
@override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED)
|
||||
def test_render_html_view_valid_certificate(self):
|
||||
@@ -1006,7 +969,7 @@ class CertificatesViewsTests(CommonCertificatesTestCase, CacheIsolationTestCase)
|
||||
day=expected_date.day,
|
||||
year=expected_date.year
|
||||
)
|
||||
self.assertIn(date, response.content.decode(response.charset))
|
||||
self.assertContains(response, date)
|
||||
|
||||
@override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED)
|
||||
def test_render_html_view_invalid_certificate_configuration(self):
|
||||
|
||||
@@ -330,17 +330,13 @@ class TestStaffMasqueradeAsSpecificStudent(StaffMasqueradeTestCase, ProblemSubmi
|
||||
# Log in as staff, and check we can see the info page.
|
||||
self.login_staff()
|
||||
response = self.get_course_info_page()
|
||||
self.assertEqual(response.status_code, 200)
|
||||
content = response.content.decode('utf-8')
|
||||
self.assertIn("OOGIE BLOOGIE", content)
|
||||
self.assertContains(response, "OOGIE BLOOGIE")
|
||||
|
||||
# Masquerade as the student,enable the self paced configuration, and check we can see the info page.
|
||||
SelfPacedConfiguration(enable_course_home_improvements=True).save()
|
||||
self.update_masquerade(role='student', user_name=self.student_user.username)
|
||||
response = self.get_course_info_page()
|
||||
self.assertEqual(response.status_code, 200)
|
||||
content = response.content.decode('utf-8')
|
||||
self.assertIn("OOGIE BLOOGIE", content)
|
||||
self.assertContains(response, "OOGIE BLOOGIE")
|
||||
|
||||
@ddt.data(
|
||||
'john', # Non-unicode username
|
||||
|
||||
@@ -333,15 +333,15 @@ class ViewsTestCase(ModuleStoreTestCase):
|
||||
|
||||
def test_index_success(self):
|
||||
response = self._verify_index_response()
|
||||
self.assertIn(six.text_type(self.problem2.location), response.content.decode("utf-8"))
|
||||
self.assertContains(response, self.problem2.location)
|
||||
|
||||
# re-access to the main course page redirects to last accessed view.
|
||||
url = reverse('courseware', kwargs={'course_id': six.text_type(self.course_key)})
|
||||
response = self.client.get(url)
|
||||
self.assertEqual(response.status_code, 302)
|
||||
response = self.client.get(response.url)
|
||||
self.assertNotIn(six.text_type(self.problem.location), response.content.decode("utf-8"))
|
||||
self.assertIn(six.text_type(self.problem2.location), response.content.decode("utf-8"))
|
||||
self.assertNotContains(response, self.problem.location)
|
||||
self.assertContains(response, self.problem2.location)
|
||||
|
||||
def test_index_nonexistent_chapter(self):
|
||||
self._verify_index_response(expected_response_code=404, chapter_name='non-existent')
|
||||
@@ -509,8 +509,7 @@ class ViewsTestCase(ModuleStoreTestCase):
|
||||
|
||||
# Generate the course about page content
|
||||
response = self.client.get(reverse('about_course', args=[six.text_type(course.id)]))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn(href, response.content.decode(response.charset))
|
||||
self.assertContains(response, href)
|
||||
|
||||
@ddt.data(True, False)
|
||||
def test_ecommerce_checkout(self, is_anonymous):
|
||||
@@ -1950,7 +1949,7 @@ class ProgressPageShowCorrectnessTests(ProgressPageBaseTests):
|
||||
# Test individual problem scores
|
||||
if show_grades:
|
||||
# If grades are shown, we should be able to see the current problem scores.
|
||||
self.assertIn(expected_score, response.content.decode("utf-8"))
|
||||
self.assertContains(response, expected_score)
|
||||
|
||||
if graded:
|
||||
expected_summary_text = u"Problem Scores:"
|
||||
@@ -1959,7 +1958,7 @@ class ProgressPageShowCorrectnessTests(ProgressPageBaseTests):
|
||||
|
||||
else:
|
||||
# If grades are hidden, we should not be able to see the current problem scores.
|
||||
self.assertNotIn(expected_score, response.content.decode("utf-8"))
|
||||
self.assertNotContains(response, expected_score)
|
||||
|
||||
if graded:
|
||||
expected_summary_text = u"Problem scores are hidden"
|
||||
@@ -1972,7 +1971,7 @@ class ProgressPageShowCorrectnessTests(ProgressPageBaseTests):
|
||||
expected_summary_text += u'.'
|
||||
|
||||
# Ensure that expected text is present
|
||||
self.assertIn(expected_summary_text, response.content.decode("utf-8"))
|
||||
self.assertContains(response, expected_summary_text)
|
||||
|
||||
# Test overall sequential score
|
||||
if graded and max_score > 0:
|
||||
@@ -1983,9 +1982,9 @@ class ProgressPageShowCorrectnessTests(ProgressPageBaseTests):
|
||||
percentageString)
|
||||
|
||||
if show_grades:
|
||||
self.assertIn(expected_grade_summary, response.content.decode("utf-8"))
|
||||
self.assertContains(response, expected_grade_summary)
|
||||
else:
|
||||
self.assertNotIn(expected_grade_summary, response.content.decode("utf-8"))
|
||||
self.assertNotContains(response, expected_grade_summary)
|
||||
|
||||
@ddt.data(
|
||||
('', None, False),
|
||||
|
||||
@@ -153,8 +153,7 @@ class TestSysAdminMongoCourseImport(SysadminBaseTestCase):
|
||||
|
||||
# Create git loaded course
|
||||
response = self._add_edx4edx()
|
||||
self.assertIn(Text(text_type(GitImportErrorNoDir(settings.GIT_REPO_DIR))),
|
||||
response.content.decode('UTF-8'))
|
||||
self.assertContains(response, Text(text_type(GitImportErrorNoDir(settings.GIT_REPO_DIR))))
|
||||
|
||||
def test_mongo_course_add_delete(self):
|
||||
"""
|
||||
@@ -315,10 +314,7 @@ class TestSysAdminMongoCourseImport(SysadminBaseTestCase):
|
||||
page
|
||||
)
|
||||
)
|
||||
self.assertIn(
|
||||
u'Page {} of 2'.format(expected),
|
||||
response.content.decode(response.charset)
|
||||
)
|
||||
self.assertContains(response, u'Page {} of 2'.format(expected))
|
||||
|
||||
CourseImportLog.objects.delete()
|
||||
|
||||
|
||||
@@ -869,7 +869,7 @@ class TestInstructorAPIBulkAccountCreationAndEnrollment(SharedModuleStoreTestCas
|
||||
user.is_active = False
|
||||
user.save()
|
||||
|
||||
csv_content = b"{email},{username},tester,USA".format(email=conflicting_email, username='new_test_student')
|
||||
csv_content = "{email},{username},tester,USA".format(email=conflicting_email, username='new_test_student')
|
||||
uploaded_file = SimpleUploadedFile("temp.csv", six.b(csv_content))
|
||||
response = self.client.post(self.url, {'students_list': uploaded_file})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@@ -2673,9 +2673,10 @@ class TestInstructorAPILevelsDataDump(SharedModuleStoreTestCase, LoginEnrollment
|
||||
|
||||
# Now invalidate the same invoice number and expect an Bad request
|
||||
response = self.assert_request_status_code(400, url, method="POST", data=data)
|
||||
self.assertIn(
|
||||
self.assertContains(
|
||||
response,
|
||||
"The sale associated with this invoice has already been invalidated.",
|
||||
response.content.decode('utf-8')
|
||||
status_code=400,
|
||||
)
|
||||
|
||||
# now re_validate the invoice number
|
||||
@@ -5171,7 +5172,6 @@ class TestCourseRegistrationCodes(SharedModuleStoreTestCase):
|
||||
}
|
||||
|
||||
response = self.client.post(generate_code_url, data, **{'HTTP_HOST': 'localhost'})
|
||||
self.assertEqual(response.status_code, 400, response.content.decode('utf-8'))
|
||||
self.assertContains(response, 'Could not parse amount as', status_code=400)
|
||||
|
||||
def test_get_historical_coupon_codes(self):
|
||||
|
||||
@@ -136,10 +136,10 @@ class TestLetterCutoffPolicy(TestGradebook):
|
||||
|
||||
def test_styles(self):
|
||||
|
||||
self.assertIn(u"grade_A {color:green;}", self.response.content.decode(self.response.charset))
|
||||
self.assertIn(u"grade_B {color:Chocolate;}", self.response.content.decode(self.response.charset))
|
||||
self.assertIn(u"grade_C {color:DarkSlateGray;}", self.response.content.decode(self.response.charset))
|
||||
self.assertIn(u"grade_D {color:DarkSlateGray;}", self.response.content.decode(self.response.charset))
|
||||
self.assertContains(self.response, u"grade_A {color:green;}")
|
||||
self.assertContains(self.response, u"grade_B {color:Chocolate;}")
|
||||
self.assertContains(self.response, u"grade_C {color:DarkSlateGray;}")
|
||||
self.assertContains(self.response, u"grade_D {color:DarkSlateGray;}")
|
||||
|
||||
def test_assigned_grades(self):
|
||||
# Users 9-10 have >= 90% on Homeworks [2]
|
||||
|
||||
@@ -323,7 +323,7 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT
|
||||
self.assertContains(response, '<th scope="row">Professional</th>')
|
||||
|
||||
# dashboard link hidden
|
||||
self.assertNotIn(self.get_dashboard_enrollment_message(), response.content.decode(response.charset))
|
||||
self.assertNotContains(response, self.get_dashboard_enrollment_message())
|
||||
|
||||
@patch.dict(settings.FEATURES, {'DISPLAY_ANALYTICS_ENROLLMENTS': True})
|
||||
@override_settings(ANALYTICS_DASHBOARD_URL='')
|
||||
|
||||
@@ -111,13 +111,11 @@ class TestOrderHistoryOnSiteDashboard(SiteMixin, ModuleStoreTestCase):
|
||||
receipt_url_cert = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.certificate_order_id})
|
||||
receipt_url_donation = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.donation_order_id})
|
||||
|
||||
# We need to decode because of these chars: © & ▸
|
||||
content = response.content.decode('utf-8')
|
||||
self.assertIn(receipt_url_course, content)
|
||||
self.assertNotIn(receipt_url_course2, content)
|
||||
self.assertNotIn(receipt_url, content)
|
||||
self.assertNotIn(receipt_url_cert, content)
|
||||
self.assertNotIn(receipt_url_donation, content)
|
||||
self.assertContains(response, receipt_url_course)
|
||||
self.assertNotContains(response, receipt_url_course2)
|
||||
self.assertNotContains(response, receipt_url)
|
||||
self.assertNotContains(response, receipt_url_cert)
|
||||
self.assertNotContains(response, receipt_url_donation)
|
||||
|
||||
def test_shows_orders_with_non_site_courses_only_when_no_configuration_override_exists(self):
|
||||
self.use_site(self.site_other)
|
||||
@@ -133,11 +131,9 @@ class TestOrderHistoryOnSiteDashboard(SiteMixin, ModuleStoreTestCase):
|
||||
kwargs={'ordernum': self.courseless_donation_order_id},
|
||||
)
|
||||
|
||||
# We need to decode because of these chars: © & ▸
|
||||
content = response.content.decode('utf-8')
|
||||
self.assertNotIn(receipt_url_course, content)
|
||||
self.assertNotIn(receipt_url_course2, content)
|
||||
self.assertIn(receipt_url, content)
|
||||
self.assertIn(receipt_url_cert, content)
|
||||
self.assertIn(receipt_url_donation, content)
|
||||
self.assertIn(receipt_url_courseless_donation, content)
|
||||
self.assertNotContains(response, receipt_url_course)
|
||||
self.assertNotContains(response, receipt_url_course2)
|
||||
self.assertContains(response, receipt_url)
|
||||
self.assertContains(response, receipt_url_cert)
|
||||
self.assertContains(response, receipt_url_donation)
|
||||
self.assertContains(response, receipt_url_courseless_donation)
|
||||
|
||||
@@ -2160,8 +2160,7 @@ class CSVReportViewsTest(SharedModuleStoreTestCase):
|
||||
self.assertEqual(template, 'shoppingcart/download_report.html')
|
||||
self.assertFalse(context['total_count_error'])
|
||||
self.assertTrue(context['date_fmt_error'])
|
||||
self.assertIn("There was an error in your date input. It should be formatted as YYYY-MM-DD",
|
||||
response.content.decode('UTF-8'))
|
||||
self.assertContains(response, "There was an error in your date input. It should be formatted as YYYY-MM-DD")
|
||||
|
||||
def test_report_csv_itemized(self):
|
||||
report_type = 'itemized_purchase_report'
|
||||
|
||||
@@ -78,7 +78,5 @@ class SoftwareSecureFakeViewEnabledTest(SoftwareSecureFakeViewTest):
|
||||
'/verify_student/software-secure-fake-response'
|
||||
)
|
||||
|
||||
self.assertEqual(response.status_code, 200)
|
||||
content = response.content.decode('utf8')
|
||||
self.assertIn('EdX-ID', content)
|
||||
self.assertIn('results_callback', content)
|
||||
self.assertContains(response, 'EdX-ID')
|
||||
self.assertContains(response, 'results_callback')
|
||||
|
||||
@@ -872,5 +872,4 @@ class AccountCreationTestCaseWithSiteOverrides(SiteMixin, TestCase):
|
||||
ALLOW_PUBLIC_ACCOUNT_CREATION flag is turned off
|
||||
"""
|
||||
response = self.client.get(reverse('signin_user'))
|
||||
self.assertNotIn(u'<a class="btn-neutral" href="/register?next=%2Fdashboard">Register</a>',
|
||||
response.content.decode(response.charset))
|
||||
self.assertNotContains(response, u'<a class="btn-neutral" href="/register?next=%2Fdashboard">Register</a>')
|
||||
|
||||
@@ -970,9 +970,9 @@ class CourseHomeFragmentViewTests(ModuleStoreTestCase):
|
||||
url = EcommerceService().get_checkout_page_url(self.verified_mode.sku)
|
||||
self.assertContains(response, '<a class="btn-brand btn-upgrade"')
|
||||
self.assertContains(response, url)
|
||||
self.assertIn(
|
||||
self.assertContains(
|
||||
response,
|
||||
u"Upgrade (<span class='price'>${price}</span>)".format(price=self.verified_mode.min_price),
|
||||
response.content.decode(response.charset)
|
||||
)
|
||||
|
||||
def test_no_upgrade_message_if_logged_out(self):
|
||||
@@ -1012,5 +1012,4 @@ class CourseHomeFragmentViewTests(ModuleStoreTestCase):
|
||||
with SHOW_UPGRADE_MSG_ON_COURSE_HOME.override(True):
|
||||
response = self.client.get(self.url)
|
||||
|
||||
content = response.content.decode(response.charset)
|
||||
assert "<span>DISCOUNT_PRICE</span>" in content
|
||||
self.assertContains(response, "<span>DISCOUNT_PRICE</span>")
|
||||
|
||||
@@ -121,9 +121,6 @@ class TestCourseOutlinePage(SharedModuleStoreTestCase):
|
||||
|
||||
url = course_home_url(course)
|
||||
response = self.client.get(url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
response_content = response.content.decode("utf-8")
|
||||
|
||||
self.assertTrue(course.children)
|
||||
for chapter in course.children:
|
||||
self.assertContains(response, chapter.display_name)
|
||||
|
||||
@@ -103,8 +103,7 @@ class TestCourseSockView(SharedModuleStoreTestCase):
|
||||
)
|
||||
def test_upgrade_message_discount(self):
|
||||
response = self.client.get(course_home_url(self.verified_course))
|
||||
content = response.content.decode(response.charset)
|
||||
assert "<span>DISCOUNT_PRICE</span>" in content
|
||||
self.assertContains(response, "<span>DISCOUNT_PRICE</span>")
|
||||
|
||||
def assert_verified_sock_is_visible(self, course, response):
|
||||
return self.assertContains(response, TEST_VERIFICATION_SOCK_LOCATOR, html=False)
|
||||
|
||||
Reference in New Issue
Block a user