'Regression test for #19327'

def test_double_login_is_not_allowed(self):

    login_url = ('%s?next=%s' % (reverse('admin:login'), reverse('admin:index')))
    response = self.client.get(self.index_url)
    self.assertEqual(response.status_code, 302)
    login = self.client.post(login_url, self.super_login)
    self.assertRedirects(login, self.index_url)
    self.assertFalse(login.context)
    login = self.client.post(login_url, self.joepublic_login)
    self.assertEqual(login.status_code, 200)
    self.assertContains(login, ERROR_MESSAGE)
    login = self.client.post(login_url, self.super_login)
    self.assertRedirects(login, self.index_url)
    self.assertFalse(login.context)
    login = self.client.post(login_url, self.super_login)
    self.assertRedirects(login, self.index_url)
    self.assertFalse(login.context)
    self.client.get(reverse('admin:logout'))
