Beispiel #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'))
Beispiel #2
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'))
Beispiel #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'))
Beispiel #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'))