Python 3: multi-lined assertIn, assertNotIn -> assertContains, assertNotContains

This commit is contained in:
Nimisha Asthagiri
2019-09-29 00:22:48 -04:00
parent beb95eb69c
commit 9bbc21ea8c
20 changed files with 93 additions and 148 deletions

View File

@@ -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):
"""