def test_multiline(self): l = """ GET "/foo" ir,@1 """ r = language.parse_request({}, l) assert r.method.string() == "GET" assert r.path.string() == "/foo" assert r.actions l = """ GET "/foo bar" ir,@1 """ r = language.parse_request({}, l) assert r.method.string() == "GET" assert r.path.string().endswith("bar") assert r.actions
def test_multiline(self): l = """ GET "/foo" ir,@1 """ r = language.parse_request({}, l) assert r.method.string() == "GET" assert r.path.string() == "/foo" assert r.actions l = """ GET "/foo bar" ir,@1 """ r = language.parse_request({}, l) assert r.method.string() == "GET" assert r.path.string().endswith("bar") assert r.actions
def test_simple(self): r = language.parse_request({}, 'GET:"/foo"') assert r.method.string() == "GET" assert r.path.string() == "/foo" r = language.parse_request({}, 'GET:/foo') assert r.path.string() == "/foo" r = language.parse_request({}, 'GET:@1k') assert len(r.path.string()) == 1024
def test_simple(self): r = language.parse_request({}, 'GET:"/foo"') assert r.method.string() == "GET" assert r.path.string() == "/foo" r = language.parse_request({}, 'GET:/foo') assert r.path.string() == "/foo" r = language.parse_request({}, 'GET:@1k') assert len(r.path.string()) == 1024
def test_shortcuts(self): assert language.parse_response( {}, "400:c'foo'").headers[0].key.val == "Content-Type" assert language.parse_response( {}, "400:l'foo'").headers[0].key.val == "Location" assert 'Android' in language.parse_request( {}, "get:/:ua").headers[0].value.val assert language.parse_request( {}, "get:/:ua").headers[0].key.val == "User-Agent"
def rt(s): s = language.parse_request({}, s).spec() assert language.parse_request({}, s).spec() == s
def test_render(self): s = cStringIO.StringIO() r = language.parse_request({}, "GET:'/foo'") assert language.serve(r, s, {}, "foo.com")
def test_file(self): p = tutils.test_data.path("data") d = dict(staticdir=p) r = language.parse_request(d, "+request") assert r.path.values({})[0][:] == "/foo"
def test_resolve(self): r = language.parse_request({}, 'GET:"/foo"') e = language.DisconnectAt("r") ret = e.resolve(r, {}) assert isinstance(ret.offset, int)
def test_resolve(self): r = language.parse_request({}, 'GET:"/foo"') e = language.DisconnectAt("r") ret = e.resolve(r, {}) assert isinstance(ret.offset, int)
def test_path_generator(self): r = language.parse_request({}, "GET:@100").freeze({}) assert len(r.spec()) > 100
def test_freeze(self): r = language.parse_request({}, "GET:/:b@100").freeze({}) assert len(r.spec()) > 100
def rt(s): s = language.parse_request({}, s).spec() assert language.parse_request({}, s).spec() == s
def test_render(self): s = cStringIO.StringIO() r = language.parse_request({}, "GET:'/foo'") assert language.serve(r, s, {}, "foo.com")
def test_file(self): p = tutils.test_data.path("data") d = dict(staticdir=p) r = language.parse_request(d, "+request") assert r.path.values({})[0][:] == "/foo"
def test_freeze(self): r = language.parse_request({}, "GET:/:b@100").freeze({}) assert len(r.spec()) > 100
def test_path_generator(self): r = language.parse_request({}, "GET:@100").freeze({}) assert len(r.spec()) > 100
def test_shortcuts(self): assert language.parse_response({}, "400:c'foo'").headers[0].key.val == "Content-Type" assert language.parse_response({}, "400:l'foo'").headers[0].key.val == "Location" assert 'Android' in language.parse_request({}, "get:/:ua").headers[0].value.val assert language.parse_request({}, "get:/:ua").headers[0].key.val == "User-Agent"