def test_non_existing_sub_route(self): sub_route = Route(FAKE_VIEW, 'sub_route_1') route = Route(FAKE_VIEW, FAKE_ROUTE_NAME, [sub_route]) non_existing_route_name = 'non_existing' with assert_raises_substring( NonExistingRouteError, non_existing_route_name, ): route.get_route_by_name(non_existing_route_name)
def test_existing_direct_sub_route(self): sub_route_name = 'sub_route_1' sub_route = Route(FAKE_VIEW, sub_route_name) route = Route(FAKE_VIEW, FAKE_ROUTE_NAME, [sub_route]) retrieved_route = route.get_route_by_name(sub_route_name) eq_(sub_route, retrieved_route)
def test_existing_own_route(self): route_name = 'route_1' route = Route(FAKE_VIEW, route_name) retrieved_route = route.get_route_by_name(route_name) eq_(route, retrieved_route)