Exemple #1
0
 def test_login(self):
     factory = RequestFactory()
     request = factory.post(reverse('auth'), {'username': '******', 'password': '******'})
     request.user = self.user
     middleware = SessionMiddleware()
     middleware.process_request(request)
     request.session.save()
     response = auth(request)
     self.assertTrue(response.status_code == 302)
     self.assertTrue(response.get('location') == reverse('home'))
 def test_login(self):
     factory = RequestFactory()
     request = factory.post(reverse('auth'), {
         'username': '******',
         'password': '******'
     })
     request.user = self.user
     middleware = SessionMiddleware()
     middleware.process_request(request)
     request.session.save()
     response = auth(request)
     self.assertTrue(response.status_code == 302)
     self.assertTrue(response.get('location') == reverse('home'))
Exemple #3
0
    def test_login(self):
        """
        Test that a user can login and is redirected to the home page

        """

        request = self.factory.post(reverse('auth'), {'username': '******', 'password': '******'})
        request.user = self.user
        apply_middleware(request)
        response = auth(request)

        self.assertTrue(response.status_code == 302)
        self.assertTrue(response.get('location') == reverse('home'))
Exemple #4
0
    def test_login(self):
        """
        Test that a user can login and is redirected to the home page

        """

        request = self.factory.post(reverse('auth'), {'username': '******', 'password': '******'})
        request.user = self.user
        apply_middleware(request)
        response = auth(request)

        self.assertTrue(response.status_code == 302)
        self.assertTrue(response.get('location') == reverse('home'))