def test_subapp_rule_resource(app): subapp = web.Application() subapp.router.add_get('/', make_handler()) rule = Domain('example.com') assert rule.get_info() == {'domain': 'example.com'} resource = app.add_domain('example.com', subapp) assert resource.canonical == 'example.com' assert resource.get_info() == {'rule': resource._rule, 'app': subapp} resource.add_prefix('/a') resource.raw_match('/b') assert len(resource) assert list(resource) assert repr(resource).startswith('<MatchedSubAppResource') with pytest.raises(RuntimeError): resource.url_for()
def test_subapp_rule_resource(app: Any) -> None: subapp = web.Application() subapp.router.add_get("/", make_handler()) rule = Domain("example.com") assert rule.get_info() == {"domain": "example.com"} resource = app.add_domain("example.com", subapp) assert resource.canonical == "example.com" assert resource.get_info() == {"rule": resource._rule, "app": subapp} resource.add_prefix("/a") resource.raw_match("/b") assert len(resource) assert list(resource) assert repr(resource).startswith("<MatchedSubAppResource") with pytest.raises(RuntimeError): resource.url_for()
def test_subapp_rule_resource(app): subapp = web.Application() subapp.router.add_get('/', make_handler()) rule = Domain('example.com') assert rule.get_info() == {'domain': 'example.com'} resource = app.add_domain('example.com', subapp) assert resource.canonical == 'example.com' assert resource.get_info() == {'rule': resource._rule, 'app': subapp} resource.add_prefix('/a') resource.raw_match('/b') assert len(resource) assert list(resource) assert repr(resource).startswith('<MatchedSubAppResource') with pytest.raises(RuntimeError): resource.url_for()