def test_app_registry(): ar = flow.AppRegistry() ar.add("foo", "domain", 80) r = tutils.treq() r.set_url("http://domain:80/") assert ar.get(r) r.port = 81 assert not ar.get(r) r = tutils.treq() r.host = "domain2" r.port = 80 assert not ar.get(r) r.headers["host"] = ["domain"] assert ar.get(r)
def test_app_registry(): ar = flow.AppRegistry() ar.add("foo", "domain", 80) r = HTTPRequest.wrap(netlib.tutils.treq()) r.host = "domain" r.port = 80 assert ar.get(r) r.port = 81 assert not ar.get(r) r = HTTPRequest.wrap(netlib.tutils.treq()) r.host = "domain2" r.port = 80 assert not ar.get(r) r.headers["host"] = "domain" assert ar.get(r)