'Make sure only staff members can log in.
Successful posts to the login page will redirect to the orignal url.
Unsuccessfull attempts will continue to render the login page with
a 200 status code.'

def test_staff_member_required_decorator_works_as_per_admin_login(self):

    request = self.client.get('/test_admin/admin/secure-view/')
    self.assertEqual(request.status_code, 200)
    login = self.client.post('/test_admin/admin/secure-view/', self.super_login)
    self.assertRedirects(login, '/test_admin/admin/secure-view/')
    self.assertFalse(login.context)
    self.client.get('/test_admin/admin/logout/')
    self.assertEqual(self.client.session.test_cookie_worked(), False)
    request = self.client.get('/test_admin/admin/secure-view/')
    self.assertEqual(request.status_code, 200)
    login = self.client.post('/test_admin/admin/secure-view/', self.super_email_login)
    self.assertContains(login, 'Your    e-mail    address    is    not    your    username')
    login = self.client.post('/test_admin/admin/secure-view/', self.super_email_bad_login)
    self.assertContains(login, 'Please    enter    a    correct    username    and    password.')
    new_user = User(username='jondoe', password='secret', email='super@example.com')
    new_user.save()
    login = self.client.post('/test_admin/admin/secure-view/', self.super_email_login)
    self.assertContains(login, 'Please    enter    a    correct    username    and    password.')
    request = self.client.get('/test_admin/admin/secure-view/')
    self.assertEqual(request.status_code, 200)
    login = self.client.post('/test_admin/admin/secure-view/', self.adduser_login)
    self.assertRedirects(login, '/test_admin/admin/secure-view/')
    self.assertFalse(login.context)
    self.client.get('/test_admin/admin/logout/')
    request = self.client.get('/test_admin/admin/secure-view/')
    self.assertEqual(request.status_code, 200)
    login = self.client.post('/test_admin/admin/secure-view/', self.changeuser_login)
    self.assertRedirects(login, '/test_admin/admin/secure-view/')
    self.assertFalse(login.context)
    self.client.get('/test_admin/admin/logout/')
    request = self.client.get('/test_admin/admin/secure-view/')
    self.assertEqual(request.status_code, 200)
    login = self.client.post('/test_admin/admin/secure-view/', self.deleteuser_login)
    self.assertRedirects(login, '/test_admin/admin/secure-view/')
    self.assertFalse(login.context)
    self.client.get('/test_admin/admin/logout/')
    request = self.client.get('/test_admin/admin/secure-view/')
    self.assertEqual(request.status_code, 200)
    login = self.client.post('/test_admin/admin/secure-view/', self.joepublic_login)
    self.assertEqual(login.status_code, 200)
    self.assertContains(login, 'Please    enter    a    correct    username    and    password.')
    login = self.client.login(username='joepublic', password='secret')
    self.client.get('/test_admin/admin/secure-view/')
    self.client.post('/test_admin/admin/secure-view/', self.super_login)
    self.assertEqual(self.client.session.test_cookie_worked(), False)
