Fix many wrong-assert-type errors
This commit is contained in:
@@ -132,7 +132,7 @@ class BasicAssetsTestCase(AssetsTestCase):
|
||||
url = asset_url.replace('"', '')
|
||||
base_url = url.replace(filename, '')
|
||||
|
||||
self.assertTrue("/{}".format(filename) in url)
|
||||
self.assertIn("/{}".format(filename), url)
|
||||
resp = self.client.get(url)
|
||||
self.assertEquals(resp.status_code, 200)
|
||||
|
||||
@@ -142,7 +142,7 @@ class BasicAssetsTestCase(AssetsTestCase):
|
||||
# browser append relative_path with base_url
|
||||
absolute_path = base_url + relative_path
|
||||
|
||||
self.assertTrue("/{}".format(relative_path) in absolute_path)
|
||||
self.assertIn("/{}".format(relative_path), absolute_path)
|
||||
resp = self.client.get(absolute_path)
|
||||
self.assertEquals(resp.status_code, 200)
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ class CertificatesBaseTestCase(object):
|
||||
with self.assertRaises(Exception) as context:
|
||||
CertificateManager.validate(json_data_1)
|
||||
|
||||
self.assertTrue("Unsupported certificate schema version: 100. Expected version: 1." in context.exception)
|
||||
self.assertIn("Unsupported certificate schema version: 100. Expected version: 1.", context.exception)
|
||||
|
||||
#Test certificate name is missing
|
||||
json_data_2 = {
|
||||
@@ -192,7 +192,7 @@ class CertificatesBaseTestCase(object):
|
||||
with self.assertRaises(Exception) as context:
|
||||
CertificateManager.validate(json_data_2)
|
||||
|
||||
self.assertTrue('must have name of the certificate' in context.exception)
|
||||
self.assertIn('must have name of the certificate', context.exception)
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
|
||||
@@ -149,14 +149,14 @@ class TestCourseIndex(CourseTestCase):
|
||||
|
||||
# Now verify the first child
|
||||
children = json_response['child_info']['children']
|
||||
self.assertTrue(len(children) > 0)
|
||||
self.assertGreater(len(children), 0)
|
||||
first_child_response = children[0]
|
||||
self.assertEqual(first_child_response['category'], 'chapter')
|
||||
self.assertEqual(first_child_response['id'], unicode(chapter.location))
|
||||
self.assertEqual(first_child_response['display_name'], 'Week 1')
|
||||
self.assertTrue(json_response['published'])
|
||||
self.assertEqual(first_child_response['visibility_state'], VisibilityState.unscheduled)
|
||||
self.assertTrue(len(first_child_response['child_info']['children']) > 0)
|
||||
self.assertGreater(len(first_child_response['child_info']['children']), 0)
|
||||
|
||||
# Finally, validate the entire response for consistency
|
||||
self.assert_correct_json_response(json_response)
|
||||
@@ -351,14 +351,14 @@ class TestCourseOutline(CourseTestCase):
|
||||
|
||||
# Now verify the first child
|
||||
children = json_response['child_info']['children']
|
||||
self.assertTrue(len(children) > 0)
|
||||
self.assertGreater(len(children), 0)
|
||||
first_child_response = children[0]
|
||||
self.assertEqual(first_child_response['category'], 'chapter')
|
||||
self.assertEqual(first_child_response['id'], unicode(self.chapter.location))
|
||||
self.assertEqual(first_child_response['display_name'], 'Week 1')
|
||||
self.assertTrue(json_response['published'])
|
||||
self.assertEqual(first_child_response['visibility_state'], VisibilityState.unscheduled)
|
||||
self.assertTrue(len(first_child_response['child_info']['children']) > 0)
|
||||
self.assertGreater(len(first_child_response['child_info']['children']), 0)
|
||||
|
||||
# Finally, validate the entire response for consistency
|
||||
self.assert_correct_json_response(json_response)
|
||||
|
||||
@@ -71,7 +71,7 @@ class CourseUpdateTest(CourseTestCase):
|
||||
course_update_url = self.create_update_url()
|
||||
resp = self.client.get_json(course_update_url)
|
||||
payload = json.loads(resp.content)
|
||||
self.assertTrue(len(payload) == 2)
|
||||
self.assertEqual(len(payload), 2)
|
||||
|
||||
# try json w/o required fields
|
||||
self.assertContains(
|
||||
@@ -123,7 +123,7 @@ class CourseUpdateTest(CourseTestCase):
|
||||
url = self.create_update_url(provided_id=this_id)
|
||||
resp = self.client.delete(url)
|
||||
payload = json.loads(resp.content)
|
||||
self.assertTrue(len(payload) == before_delete - 1)
|
||||
self.assertEqual(len(payload), before_delete - 1)
|
||||
|
||||
def test_course_updates_compatibility(self):
|
||||
'''
|
||||
@@ -149,7 +149,7 @@ class CourseUpdateTest(CourseTestCase):
|
||||
resp = self.client.get_json(course_update_url)
|
||||
payload = json.loads(resp.content)
|
||||
self.assertEqual(payload, [{u'date': update_date, u'content': update_content, u'id': 1}])
|
||||
self.assertTrue(len(payload) == 1)
|
||||
self.assertEqual(len(payload), 1)
|
||||
|
||||
# test getting single update item
|
||||
|
||||
@@ -234,7 +234,7 @@ class CourseUpdateTest(CourseTestCase):
|
||||
# now confirm that the bad news and the iframe make up single update
|
||||
resp = self.client.get_json(course_update_url)
|
||||
payload = json.loads(resp.content)
|
||||
self.assertTrue(len(payload) == 1)
|
||||
self.assertEqual(len(payload), 1)
|
||||
|
||||
def post_course_update(self, send_push_notification=False):
|
||||
"""
|
||||
|
||||
@@ -335,7 +335,7 @@ class ImportTestCase(CourseTestCase):
|
||||
args = {"name": tarpath, "course-data": [tar]}
|
||||
resp = self.client.post(self.url, args)
|
||||
self.assertEquals(resp.status_code, 400)
|
||||
self.assertTrue("SuspiciousFileOperation" in resp.content)
|
||||
self.assertIn("SuspiciousFileOperation", resp.content)
|
||||
|
||||
try_tar(self._fifo_tar())
|
||||
try_tar(self._symlink_tar())
|
||||
|
||||
@@ -607,7 +607,7 @@ class TestDuplicateItem(ItemTest, DuplicateHelper):
|
||||
parent = self.get_item_from_modulestore(parent_usage_key)
|
||||
children = parent.children
|
||||
if source_position is None:
|
||||
self.assertFalse(source_usage_key in children, 'source item not expected in children array')
|
||||
self.assertNotIn(source_usage_key, children, 'source item not expected in children array')
|
||||
self.assertEqual(
|
||||
children[len(children) - 1],
|
||||
usage_key,
|
||||
@@ -2102,7 +2102,7 @@ class TestXBlockPublishingInfo(ItemTest):
|
||||
Returns the child xblock info at the specified index.
|
||||
"""
|
||||
children = xblock_info['child_info']['children']
|
||||
self.assertTrue(len(children) > index)
|
||||
self.assertGreater(len(children), index)
|
||||
return children[index]
|
||||
|
||||
def _get_xblock_info(self, location):
|
||||
|
||||
@@ -80,7 +80,7 @@ class TabsPageTests(CourseTestCase):
|
||||
num_orig_tabs = len(orig_tab_ids)
|
||||
|
||||
# make sure we have enough tabs to play around with
|
||||
self.assertTrue(num_orig_tabs >= 5)
|
||||
self.assertGreaterEqual(num_orig_tabs, 5)
|
||||
|
||||
# reorder the last two tabs
|
||||
tab_ids[num_orig_tabs - 1], tab_ids[num_orig_tabs - 2] = tab_ids[num_orig_tabs - 2], tab_ids[num_orig_tabs - 1]
|
||||
@@ -88,7 +88,7 @@ class TabsPageTests(CourseTestCase):
|
||||
# remove the middle tab
|
||||
# (the code needs to handle the case where tabs requested for re-ordering is a subset of the tabs in the course)
|
||||
removed_tab = tab_ids.pop(num_orig_tabs / 2)
|
||||
self.assertTrue(len(tab_ids) == num_orig_tabs - 1)
|
||||
self.assertEqual(len(tab_ids), num_orig_tabs - 1)
|
||||
|
||||
# post the request
|
||||
resp = self.client.ajax_post(
|
||||
@@ -205,7 +205,7 @@ class PrimitiveTabEdit(ModuleStoreTestCase):
|
||||
with self.assertRaises(IndexError):
|
||||
tabs.primitive_delete(course, 6)
|
||||
tabs.primitive_delete(course, 2)
|
||||
self.assertFalse({u'type': u'textbooks'} in course.tabs)
|
||||
self.assertNotIn({u'type': u'textbooks'}, course.tabs)
|
||||
# Check that discussion has shifted up
|
||||
self.assertEquals(course.tabs[2], {'type': 'discussion', 'name': 'Discussion'})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user