def test_multiple_handlers_with_wildcard_map(self): self.dispatcher.map('/foo/bar', 1) self.dispatcher.map('/*', 2) self.sortAndAssertSequenceEqual( [dispatcher.Handler(1, []), dispatcher.Handler(2, [])], self.dispatcher.handlers_for_address("/foo/bar"))
def test_simple_map_and_match(self): handler = object() self.dispatcher.map('/test', handler, 1, 2, 3) self.dispatcher.map('/test2', handler) self.sortAndAssertSequenceEqual( [dispatcher.Handler(handler, [1, 2, 3])], self.dispatcher.handlers_for_address('/test')) self.sortAndAssertSequenceEqual( [dispatcher.Handler(handler, [])], self.dispatcher.handlers_for_address('/test2'))
def test_use_default_handler_when_set_and_no_match(self): handler = object() self.dispatcher.set_default_handler(handler) self.sortAndAssertSequenceEqual( [dispatcher.Handler(handler, [])], self.dispatcher.handlers_for_address('/test'))