def test_include_views(self): from django.core.exceptions import ImproperlyConfigured from urlmiddleware.urlresolvers import resolve with self.assertRaises(ImproperlyConfigured): print resolve('/include_views_test/')
def test_include(self): from urlmiddleware.base import MiddlewareResolver404 from urlmiddleware.urlresolvers import resolve with self.assertRaises(MiddlewareResolver404): print resolve('/include_test/')
def test_resolve_api(self): from urlmiddleware.urlresolvers import resolve from test_urlmiddleware.middleware import NoOpMiddleWare middleware = resolve('/') self.assertEquals([NoOpMiddleWare, ], middleware)
def test_dotted_sub_path(self): from urlmiddleware.urlresolvers import resolve from test_urlmiddleware.middleware import NoOpMiddleWare6 middleware = resolve('/dotted2/') self.assertEquals([NoOpMiddleWare6, ], middleware)
def test_duplicated_middleware(self): from urlmiddleware.urlresolvers import resolve from test_urlmiddleware.middleware import NoOpMiddleWare5 middleware = resolve('/dupe/') self.assertEquals([NoOpMiddleWare5, ], middleware)
def test_resolve_multiple(self): from urlmiddleware.urlresolvers import resolve from test_urlmiddleware.middleware import NoOpMiddleWare, NoOpMiddleWare2 middleware = resolve('/sub/') self.assertEquals([NoOpMiddleWare, NoOpMiddleWare2, ], middleware)
def test_resolve_api(self): from urlmiddleware.urlresolvers import resolve from test_urlmiddleware.middleware import NoOpMiddleWare middleware = resolve('/') self.assertEquals([ NoOpMiddleWare, ], middleware)
def test_dotted_sub_path(self): from urlmiddleware.urlresolvers import resolve from test_urlmiddleware.middleware import NoOpMiddleWare6 middleware = resolve('/dotted2/') self.assertEquals([ NoOpMiddleWare6, ], middleware)
def test_duplicated_middleware(self): from urlmiddleware.urlresolvers import resolve from test_urlmiddleware.middleware import NoOpMiddleWare5 middleware = resolve('/dupe/') self.assertEquals([ NoOpMiddleWare5, ], middleware)
def test_resolve_multiple(self): from urlmiddleware.urlresolvers import resolve from test_urlmiddleware.middleware import NoOpMiddleWare, NoOpMiddleWare2 middleware = resolve('/sub/') self.assertEquals([ NoOpMiddleWare, NoOpMiddleWare2, ], middleware)
def get_matched_middleware(self, path): if path in self._cache: return self._cache[path] self._cache[path] = resolve(path) return self._cache[path]
def matched_middleware(path): return resolve(path)