assertItemsEqual with six.assertCountEqual
This commit is contained in:
Ayub khan
2019-08-21 16:26:12 +05:00
parent acf3cb684d
commit 8a95a8e520
43 changed files with 167 additions and 103 deletions

View File

@@ -1105,7 +1105,7 @@ class CcxDetailTest(CcxRestApiTest):
)
self.assertEqual(resp.data.get('coach_email'), self.ccx.coach.email) # pylint: disable=no-member
self.assertEqual(resp.data.get('master_course_id'), six.text_type(self.ccx.course_id))
self.assertItemsEqual(resp.data.get('course_modules'), self.master_course_chapters)
six.assertCountEqual(self, resp.data.get('course_modules'), self.master_course_chapters)
@ddt.data(*AUTH_ATTRS)
def test_delete_detail(self, auth_attr):
@@ -1332,19 +1332,19 @@ class CcxDetailTest(CcxRestApiTest):
resp = self.client.patch(self.detail_url, data, format='json', HTTP_AUTHORIZATION=getattr(self, auth_attr))
self.assertEqual(resp.status_code, status.HTTP_204_NO_CONTENT)
ccx_from_db = CustomCourseForEdX.objects.get(id=self.ccx.id)
self.assertItemsEqual(ccx_from_db.structure, data['course_modules'])
six.assertCountEqual(self, ccx_from_db.structure, data['course_modules'])
data = {'course_modules': []}
resp = self.client.patch(self.detail_url, data, format='json', HTTP_AUTHORIZATION=getattr(self, auth_attr))
self.assertEqual(resp.status_code, status.HTTP_204_NO_CONTENT)
ccx_from_db = CustomCourseForEdX.objects.get(id=self.ccx.id)
self.assertItemsEqual(ccx_from_db.structure, [])
six.assertCountEqual(self, ccx_from_db.structure, [])
data = {'course_modules': self.master_course_chapters}
resp = self.client.patch(self.detail_url, data, format='json', HTTP_AUTHORIZATION=getattr(self, auth_attr))
self.assertEqual(resp.status_code, status.HTTP_204_NO_CONTENT)
ccx_from_db = CustomCourseForEdX.objects.get(id=self.ccx.id)
self.assertItemsEqual(ccx_from_db.structure, self.master_course_chapters)
six.assertCountEqual(self, ccx_from_db.structure, self.master_course_chapters)
data = {'course_modules': None}
resp = self.client.patch(self.detail_url, data, format='json', HTTP_AUTHORIZATION=getattr(self, auth_attr))
@@ -1357,7 +1357,7 @@ class CcxDetailTest(CcxRestApiTest):
resp = self.client.patch(self.detail_url, data, format='json', HTTP_AUTHORIZATION=getattr(self, auth_attr))
self.assertEqual(resp.status_code, status.HTTP_204_NO_CONTENT)
ccx_from_db = CustomCourseForEdX.objects.get(id=self.ccx.id)
self.assertItemsEqual(ccx_from_db.structure, chapters)
six.assertCountEqual(self, ccx_from_db.structure, chapters)
@ddt.data(
('auth', True),
@@ -1381,7 +1381,7 @@ class CcxDetailTest(CcxRestApiTest):
else:
self.assertEqual(resp.status_code, status.HTTP_204_NO_CONTENT)
ccx_from_db = CustomCourseForEdX.objects.get(id=self.ccx.id)
self.assertItemsEqual(ccx_from_db.structure, chapters)
six.assertCountEqual(self, ccx_from_db.structure, chapters)
@ddt.data(
('auth', True),