'Verifies that an unauthenticated user attempting to access a
login_required view gets redirected to the login page and that
an authenticated user is let through.'

def test_login_required_view(self):

    view_url = '/views/create_update/member/create/article/'
    response = self.client.get(view_url)
    self.assertRedirects(response, ('/accounts/login/?next=%s' % view_url))
    login = self.client.login(username='testclient', password='password')
    self.assertTrue(login, 'Could    not    log    in')
    response = self.client.get(view_url)
    self.assertEqual(response.status_code, 200)
    self.assertTemplateUsed(response, 'views/article_form.html')
