'Test remove staff of master course to ccx course'

def test_remove_master_course_staff_from_ccx(self):

    staff = self.make_staff()
    self.assertTrue(CourseStaffRole(self.course.id).has_user(staff))
    instructor = self.make_instructor()
    self.assertTrue(CourseInstructorRole(self.course.id).has_user(instructor))
    add_master_course_staff_to_ccx(self.course, self.ccx_locator, self.ccx.display_name, send_email=False)
    list_staff_master_course = list_with_level(self.course, 'staff')
    list_instructor_master_course = list_with_level(self.course, 'instructor')
    with ccx_course(self.ccx_locator) as course_ccx:
        list_staff_ccx_course = list_with_level(course_ccx, 'staff')
        self.assertEqual(len(list_staff_master_course), len(list_staff_ccx_course))
        self.assertEqual(list_staff_master_course[0].email, list_staff_ccx_course[0].email)
        list_instructor_ccx_course = list_with_level(course_ccx, 'instructor')
        self.assertEqual(len(list_instructor_ccx_course), len(list_instructor_master_course))
        self.assertEqual(list_instructor_ccx_course[0].email, list_instructor_master_course[0].email)
        remove_master_course_staff_from_ccx(self.course, self.ccx_locator, self.ccx.display_name, send_email=False)
        list_staff_ccx_course = list_with_level(course_ccx, 'staff')
        self.assertNotEqual(len(list_staff_master_course), len(list_staff_ccx_course))
        list_instructor_ccx_course = list_with_level(course_ccx, 'instructor')
        self.assertNotEqual(len(list_instructor_ccx_course), len(list_instructor_master_course))
        for user in list_staff_master_course:
            self.assertNotIn(user, list_staff_ccx_course)
        for user in list_instructor_master_course:
            self.assertNotIn(user, list_instructor_ccx_course)
