예제 #1
0
    def test_access_redirect(self):
        """Accessing a RouteRedirect's url redirects to its target's url."""
        target = ChildRouteFactory.create()
        route = ChildRouteRedirectFactory.create(target=target)
        response = self.client.get(route.url)

        expected = 'http://testserver' + target.url
        self.assertEqual(response['Location'], expected)
예제 #2
0
    def test_target(self):
        """RouteRedirectView redirects to the target's url."""
        target = ChildRouteFactory.create()
        route = ChildRouteRedirectFactory.create(target=target)
        view = self.get_view()
        response = view(self.create_request(), route=route)

        self.assertEqual(response['Location'], target.url)
예제 #3
0
    def test_target(self):
        """RouteRedirectView redirects to the target's url."""
        target = ChildRouteFactory.create()
        route = ChildRouteRedirectFactory.create(target=target)
        view = self.get_view()
        response = view(self.create_request(), route=route)

        self.assertEqual(response['Location'], target.url)
예제 #4
0
    def test_access_redirect(self):
        """Accessing a RouteRedirect's url redirects to its target's url."""
        target = ChildRouteFactory.create()
        route = ChildRouteRedirectFactory.create(target=target)
        response = self.client.get(route.url)

        expected = target.url
        if DJANGO_LT_19:
            expected = 'http://testserver' + expected
        self.assertEqual(response['Location'], expected)