Esempio n. 1
0
    def test_raw(self):
        s = io.StringIO()
        r = language.parse_response("400:b'foo'")
        language.serve(r, s, {})
        v = s.getvalue()
        assert "Content-Length" in v

        s = io.StringIO()
        r = language.parse_response("400:b'foo':r")
        language.serve(r, s, {})
        v = s.getvalue()
        assert not "Content-Length" in v
Esempio n. 2
0
    def test_raw(self):
        s = cStringIO.StringIO()
        r = language.parse_pathod("400:b'foo'").next()
        language.serve(r, s, {})
        v = s.getvalue()
        assert "Content-Length" in v

        s = cStringIO.StringIO()
        r = language.parse_pathod("400:b'foo':r").next()
        language.serve(r, s, {})
        v = s.getvalue()
        assert "Content-Length" not in v
Esempio n. 3
0
    def test_raw(self):
        s = cStringIO.StringIO()
        r = language.parse_response("400:b'foo'")
        language.serve(r, s, {})
        v = s.getvalue()
        assert "Content-Length" in v

        s = cStringIO.StringIO()
        r = language.parse_response("400:b'foo':r")
        language.serve(r, s, {})
        v = s.getvalue()
        assert "Content-Length" not in v
Esempio n. 4
0
 def test_render_simple(self):
     s = cStringIO.StringIO()
     r = parse_request("GET:'/foo'")
     assert language.serve(
         r,
         s,
         default_settings(),
     )
Esempio n. 5
0
 def test_render_simple(self):
     s = cStringIO.StringIO()
     r = parse_request("GET:'/foo'")
     assert language.serve(
         r,
         s,
         default_settings(),
     )
Esempio n. 6
0
 def test_render(self):
     s = cStringIO.StringIO()
     r = parse_request("GET:'/foo'")
     assert language.serve(
         r,
         s,
         language.Settings(request_host="foo.com")
     )
Esempio n. 7
0
 def test_render_with_body(self):
     s = cStringIO.StringIO()
     r = parse_response('200:bfoobar')
     assert language.serve(
         r,
         s,
         default_settings(),
     )
Esempio n. 8
0
 def test_render_with_headers(self):
     s = cStringIO.StringIO()
     r = parse_response('200:h"foo"="bar"')
     assert language.serve(
         r,
         s,
         default_settings(),
     )
Esempio n. 9
0
 def test_render_simple(self):
     s = cStringIO.StringIO()
     r = parse_response('200')
     assert language.serve(
         r,
         s,
         default_settings(),
     )
Esempio n. 10
0
 def test_render_with_body(self):
     s = cStringIO.StringIO()
     r = parse_request("GET:'/foo':bfoobar")
     assert language.serve(
         r,
         s,
         default_settings(),
     )
Esempio n. 11
0
 def test_render(self):
     s = cStringIO.StringIO()
     r = parse_request("GET:'/foo'")
     assert language.serve(
         r,
         s,
         language.Settings(request_host = "foo.com")
     )
Esempio n. 12
0
 def test_render_with_body(self):
     s = cStringIO.StringIO()
     r = parse_response('200:bfoobar')
     assert language.serve(
         r,
         s,
         default_settings(),
     )
Esempio n. 13
0
 def test_render_with_headers(self):
     s = cStringIO.StringIO()
     r = parse_request('GET:/foo:h"foo"="bar"')
     assert language.serve(
         r,
         s,
         default_settings(),
     )
Esempio n. 14
0
 def test_render_with_headers(self):
     s = cStringIO.StringIO()
     r = parse_response('200:h"foo"="bar"')
     assert language.serve(
         r,
         s,
         default_settings(),
     )
Esempio n. 15
0
 def test_render_simple(self):
     s = cStringIO.StringIO()
     r = parse_response('200')
     assert language.serve(
         r,
         s,
         default_settings(),
     )
Esempio n. 16
0
 def test_render_with_body(self):
     s = cStringIO.StringIO()
     r = parse_request("GET:'/foo':bfoobar")
     assert language.serve(
         r,
         s,
         default_settings(),
     )
Esempio n. 17
0
 def test_render_with_headers(self):
     s = cStringIO.StringIO()
     r = parse_request('GET:/foo:h"foo"="bar"')
     assert language.serve(
         r,
         s,
         default_settings(),
     )
Esempio n. 18
0
    def test_render(self):
        s = io.StringIO()
        r = language.parse_response("400:m'msg'")
        assert language.serve(r, s, {})

        r = language.parse_response("400:p0,100:dr")
        assert "p0" in r.spec()
        s = r.preview_safe()
        assert "p0" not in s.spec()
Esempio n. 19
0
    def test_render(self):
        s = cStringIO.StringIO()
        r = language.parse_response("400:m'msg'")
        assert language.serve(r, s, {})

        r = language.parse_response("400:p0,100:dr")
        assert "p0" in r.spec()
        s = r.preview_safe()
        assert "p0" not in s.spec()
Esempio n. 20
0
    def test_render(self):
        s = cStringIO.StringIO()
        r = language.parse_pathod("400:m'msg'").next()
        assert language.serve(r, s, {})

        r = language.parse_pathod("400:p0,100:dr").next()
        assert "p0" in r.spec()
        s = r.preview_safe()
        assert "p0" not in s.spec()
def test_write_values_after():
    s = cStringIO.StringIO()
    r = language.parse_pathod("400:da").next()
    language.serve(r, s, {})

    s = cStringIO.StringIO()
    r = language.parse_pathod("400:pa,0").next()
    language.serve(r, s, {})

    s = cStringIO.StringIO()
    r = language.parse_pathod("400:ia,'xx'").next()
    language.serve(r, s, {})
    assert s.getvalue().endswith('xx')
Esempio n. 22
0
def test_write_values_after():
    s = cStringIO.StringIO()
    r = language.parse_pathod("400:da").next()
    language.serve(r, s, {})

    s = cStringIO.StringIO()
    r = language.parse_pathod("400:pa,0").next()
    language.serve(r, s, {})

    s = cStringIO.StringIO()
    r = language.parse_pathod("400:ia,'xx'").next()
    language.serve(r, s, {})
    assert s.getvalue().endswith('xx')
Esempio n. 23
0
    def test_write_values_after(self):
        s = cStringIO.StringIO()
        r = language.parse_response({}, "400:da")
        language.serve(r, s, {})

        s = cStringIO.StringIO()
        r = language.parse_response({}, "400:pa,0")
        language.serve(r, s, {})

        s = cStringIO.StringIO()
        r = language.parse_response({}, "400:ia,'xx'")
        language.serve(r, s, {})
        assert s.getvalue().endswith('xx')
Esempio n. 24
0
    def test_write_values_after(self):
        s = cStringIO.StringIO()
        r = language.parse_response({}, "400:da")
        language.serve(r, s, {})

        s = cStringIO.StringIO()
        r = language.parse_response({}, "400:pa,0")
        language.serve(r, s, {})

        s = cStringIO.StringIO()
        r = language.parse_response({}, "400:ia,'xx'")
        language.serve(r, s, {})
        assert s.getvalue().endswith('xx')
Esempio n. 25
0
 def test_render(self):
     s = cStringIO.StringIO()
     r = language.parse_request({}, "GET:'/foo'")
     assert language.serve(r, s, {}, "foo.com")
Esempio n. 26
0
 def test_serve(self):
     s = cStringIO.StringIO()
     r = language.parse_response({}, "400:i0,'foo'")
     assert language.serve(r, s, {})
Esempio n. 27
0
 def test_internal_response(self):
     d = cStringIO.StringIO()
     s = language.PathodErrorResponse("foo")
     language.serve(s, d, {})
Esempio n. 28
0
def test_make_error_response():
    d = cStringIO.StringIO()
    s = http2.make_error_response("foo", "bar")
    language.serve(s, d, default_settings())
Esempio n. 29
0
 def test_serve(self):
     s = cStringIO.StringIO()
     r = language.parse_response({}, "400:i0,'foo'")
     assert language.serve(r, s, {})
Esempio n. 30
0
 def testlen(x):
     s = cStringIO.StringIO()
     language.serve(x, s, {})
     assert x.length({}) == len(s.getvalue())
Esempio n. 31
0
def test_make_error_response():
    d = cStringIO.StringIO()
    s = http.make_error_response("foo")
    language.serve(s, d, {})
Esempio n. 32
0
def render(r, settings=language.Settings()):
    r = r.resolve(settings)
    s = cStringIO.StringIO()
    assert language.serve(r, s, settings)
    return s.getvalue()
Esempio n. 33
0
def render(r, settings=language.Settings()):
    r = r.resolve(settings)
    s = cStringIO.StringIO()
    assert language.serve(r, s, settings)
    return s.getvalue()
 def test_serve(self):
     s = cStringIO.StringIO()
     r = language.parse_pathod("400:i0,'foo'").next()
     assert language.serve(r, s, {})
Esempio n. 35
0
 def testlen(x):
     s = cStringIO.StringIO()
     language.serve(x, s, {})
     assert x.length({}) == len(s.getvalue())
Esempio n. 36
0
 def test_render(self):
     s = cStringIO.StringIO()
     r = language.parse_response({}, "400:m'msg'")
     assert language.serve(r, s, {})
Esempio n. 37
0
def test_make_error_response():
    d = cStringIO.StringIO()
    s = http.make_error_response("foo")
    language.serve(s, d, {})
Esempio n. 38
0
 def testlen(x):
     s = cStringIO.StringIO()
     m = x.maximum_length({})
     language.serve(x, s, {})
     assert m >= len(s.getvalue())
Esempio n. 39
0
 def testlen(x):
     s = cStringIO.StringIO()
     x = x.next()
     language.serve(x, s, language.Settings())
     assert x.length(language.Settings()) == len(s.getvalue())
Esempio n. 40
0
 def test_internal_response(self):
     d = cStringIO.StringIO()
     s = language.make_error_response("foo")
     language.serve(s, d, {})
Esempio n. 41
0
def test_make_error_response():
    d = cStringIO.StringIO()
    s = http2.make_error_response("foo", "bar")
    language.serve(s, d, default_settings())
Esempio n. 42
0
 def test_render(self):
     s = cStringIO.StringIO()
     r = language.parse_request({}, "GET:'/foo'")
     assert language.serve(r, s, {}, "foo.com")
Esempio n. 43
0
 def testlen(x):
     s = cStringIO.StringIO()
     language.serve(x, s, language.Settings())
     assert x.length(language.Settings()) == len(s.getvalue())
Esempio n. 44
0
 def test_render(self):
     s = cStringIO.StringIO()
     r = language.parse_response({}, "400:m'msg'")
     assert language.serve(r, s, {})
Esempio n. 45
0
 def test_internal_response(self):
     d = cStringIO.StringIO()
     s = language.make_error_response("foo")
     language.serve(s, d, {})
Esempio n. 46
0
 def testlen(x):
     s = cStringIO.StringIO()
     m = x.maximum_length({})
     language.serve(x, s, {})
     assert m >= len(s.getvalue())
Esempio n. 47
0
 def test_serve(self):
     s = cStringIO.StringIO()
     r = language.parse_pathod("400:i0,'foo'").next()
     assert language.serve(r, s, {})