def test_map(self): map = FirewallMap([ (re.compile("/admin/.*"), ([], None)), (re.compile("/blog/.*"), ([], None)) ]) paths = [ ('/admin/dashboard', ([], None)), ('/', ([], None)), ('/blog/2012', ([], None)) ] for path, expected in paths: self.assertEquals(expected, map.get_context(HTTPRequest("GET", path, connection=get_dummy_connection())))
def test_map(self): map = FirewallMap([ (re.compile("/admin/.*"), ([], None)), (re.compile("/blog/.*"), ([], None)) ]) paths = [ ('/admin/dashboard', ([], None)), ('/', ([], None)), ('/blog/2012', ([], None)) ] request = Request() for path, expected in paths: request.path = path self.assertEquals(expected, map.get_context(request))