'Test IMMEDIATE_SIGNUP feature flag and ensure the user account is
automatically created on CMS, and that we are redirected
to courses.'

@skip_unless_cms
@override_settings(FEATURES=FEATURES_WITH_SSL_AUTH_IMMEDIATE_SIGNUP)
def test_ssl_login_without_signup_cms(self):

    response = self.client.get(reverse('contentstore.views.login_page'), SSL_CLIENT_S_DN=self.AUTH_DN.format(self.USER_NAME, self.USER_EMAIL))
    self.assertEqual(response.status_code, 302)
    self.assertIn('/course', response['location'])
    try:
        ExternalAuthMap.objects.get(external_id=self.USER_EMAIL)
    except ExternalAuthMap.DoesNotExist as ex:
        self.fail('User    did    not    get    properly    added    to    external    auth    map,    exception    was    {0}'.format(str(ex)))
    try:
        User.objects.get(email=self.USER_EMAIL)
    except ExternalAuthMap.DoesNotExist as ex:
        self.fail('User    did    not    get    properly    added    to    internal    users,    exception    was    {0}'.format(str(ex)))
