'Test logging in to an account that is already linked.'

def _test_return_login(self, user_is_activated=True, previous_session_timed_out=False):

    dashboard_response = self.client.get(reverse('dashboard'))
    self.assertEqual(dashboard_response.status_code, 302)
    provider_login_url = self._check_login_page()
    try_login_response = self.client.get(provider_login_url)
    self.assertEqual(try_login_response.status_code, 302)
    login_response = self.do_provider_login(try_login_response['Location'])
    if (not previous_session_timed_out):
        self.assertEqual(login_response.status_code, 302)
        self.assertEqual(login_response['Location'], (self.url_prefix + self.complete_url))
        login_response = self.client.get(login_response['Location'])
        self.assertEqual(login_response.status_code, 302)
    if user_is_activated:
        url_expected = reverse('dashboard')
    else:
        url_expected = ((reverse('third_party_inactive_redirect') + '?next=') + reverse('dashboard'))
    self.assertEqual(login_response['Location'], (self.url_prefix + url_expected))
    dashboard_response = self.client.get(reverse('dashboard'))
    self.assertEqual(dashboard_response.status_code, 200)
