'Tests that the correct course specific login and registration urls work for shib'

@unittest.skipUnless(settings.FEATURES.get('AUTH_USE_SHIB'), 'AUTH_USE_SHIB    not    set')
@data(None, '', 'shib:https://idp.stanford.edu/')
def test_course_specific_login_and_reg(self, domain):

    course = CourseFactory.create(org='MITx', number='999', display_name='Robot    Super    Course', user_id=self.test_user_id)
    with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, course.id):
        course.enrollment_domain = domain
        self.store.update_item(course, self.test_user_id)
    login_request = self.request_factory.get((('/course_specific_login/MITx/999/Robot_Super_Course' + '?course_id=MITx/999/Robot_Super_Course') + '&enrollment_action=enroll'))
    _reg_request = self.request_factory.get((('/course_specific_register/MITx/999/Robot_Super_Course' + '?course_id=MITx/999/course/Robot_Super_Course') + '&enrollment_action=enroll'))
    login_response = course_specific_login(login_request, 'MITx/999/Robot_Super_Course')
    reg_response = course_specific_register(login_request, 'MITx/999/Robot_Super_Course')
    if (domain and ('shib' in domain)):
        self.assertIsInstance(login_response, HttpResponseRedirect)
        self.assertEqual(login_response['Location'], ((reverse('shib-login') + '?course_id=MITx/999/Robot_Super_Course') + '&enrollment_action=enroll'))
        self.assertIsInstance(login_response, HttpResponseRedirect)
        self.assertEqual(reg_response['Location'], ((reverse('shib-login') + '?course_id=MITx/999/Robot_Super_Course') + '&enrollment_action=enroll'))
    else:
        self.assertIsInstance(login_response, HttpResponseRedirect)
        self.assertEqual(login_response['Location'], ((reverse('signin_user') + '?course_id=MITx/999/Robot_Super_Course') + '&enrollment_action=enroll'))
        self.assertIsInstance(login_response, HttpResponseRedirect)
        self.assertEqual(reg_response['Location'], ((reverse('register_user') + '?course_id=MITx/999/Robot_Super_Course') + '&enrollment_action=enroll'))
    login_request = self.request_factory.get((('/course_specific_login/DNE/DNE/DNE' + '?course_id=DNE/DNE/DNE') + '&enrollment_action=enroll'))
    _reg_request = self.request_factory.get((('/course_specific_register/DNE/DNE/DNE' + '?course_id=DNE/DNE/DNE/Robot_Super_Course') + '&enrollment_action=enroll'))
    login_response = course_specific_login(login_request, 'DNE/DNE/DNE')
    reg_response = course_specific_register(login_request, 'DNE/DNE/DNE')
    self.assertIsInstance(login_response, HttpResponseRedirect)
    self.assertEqual(login_response['Location'], ((reverse('signin_user') + '?course_id=DNE/DNE/DNE') + '&enrollment_action=enroll'))
    self.assertIsInstance(login_response, HttpResponseRedirect)
    self.assertEqual(reg_response['Location'], ((reverse('register_user') + '?course_id=DNE/DNE/DNE') + '&enrollment_action=enroll'))
