'Assert that user login with cas (Central Authentication Service) is
redirect to dashboard in case of lms or upload_transcripts in case of
cms'

@patch.dict('django.conf.settings.FEATURES', {'PREVENT_CONCURRENT_LOGINS': True})
def test_single_session_with_no_user_profile(self):

    user = UserFactory.build(username='tester', email='tester@edx.org')
    user.set_password('test_password')
    user.save()
    self.assertFalse(hasattr(user, 'profile'))
    creds = {'email': 'tester@edx.org', 'password': 'test_password'}
    client1 = Client()
    client2 = Client()
    response = client1.post(self.url, creds)
    self._assert_response(response, success=True)
    user = User.objects.get(pk=user.pk)
    self.assertTrue(hasattr(user, 'profile'))
    response = client2.post(self.url, creds)
    self._assert_response(response, success=True)
    try:
        url = reverse('dashboard')
    except NoReverseMatch:
        url = reverse('upload_transcripts')
    response = client1.get(url)
    self.assertEqual(response.status_code, 302)
