Beispiel #1
0
    def test_lookup_returns_none_on_invalid_controller_or_router(self):

        route_dispatcher = RouteDispatcher(
            Router(), StubController(), DummyRequest(['/test'])
        )

        self.assertEqual(route_dispatcher.lookup(), (None, None))
Beispiel #2
0
    def test_lookup_returns_none_on_invalid_controller_or_router(self):

        route_dispatcher = RouteDispatcher(
            Router(), StubController(), DummyRequest(['/test'])
        )

        self.assertEqual(route_dispatcher.lookup(), None)
Beispiel #3
0
    def test_lookup_returns_not_implemented_on_valid_url_invalid_method(self):

        controller = StubController()
        request = request_generator(['/test/102'], method='POST')
        router = Router()
        router.install_routes(controller)
        route_dispatcher = RouteDispatcher(router, controller, request)

        self.assertEqual(route_dispatcher.lookup()[0], 'NotImplemented')
Beispiel #4
0
    def test_lookup_returns_route(self):

        controller = StubController()
        request = request_generator(['/test/102'])
        router = Router()
        router.install_routes(controller)
        route_dispatcher = RouteDispatcher(router, controller, request)

        self.assertIsInstance(route_dispatcher.lookup()[0], Route)
Beispiel #5
0
    def test_lookup_returns_not_implemented_on_valid_url_invalid_method(self):

        controller = StubController()
        request = request_generator(['/test/102'], method='POST')
        router = Router()
        router.install_routes(controller)
        route_dispatcher = RouteDispatcher(router, controller, request)

        self.assertEqual(route_dispatcher.lookup(), 'NotImplemented')
Beispiel #6
0
    def test_lookup_returns_route(self):

        controller = StubController()
        request = request_generator(['/test/102'])
        router = Router()
        router.install_routes(controller)
        route_dispatcher = RouteDispatcher(router, controller, request)

        self.assertIsInstance(route_dispatcher.lookup(), Route)