예제 #1
0
파일: test.py 프로젝트: msabramo/httq
 def test_can_use_get_method_with_unicode_args(self):
     http = HTTP(u"httq.io:8080")
     http.get(u"/hello").response()
     assert http.status_code == 200
     assert http.reason == "OK"
     assert http.content_type == "text/plain"
     assert http.readable()
     assert http.content == "hello, world"
     assert not http.readable()
     http.close()
예제 #2
0
 def test_can_use_get_method_long_hand(self):
     http = HTTP(b"httq.io:8080")
     http.get(b"/hello")
     http.response()
     assert http.readable()
     assert http.status_code == 200
     assert http.reason == "OK"
     assert http.content_type == "text/plain"
     assert http.readable()
     assert http.content == "hello, world"
     assert not http.readable()
     http.close()
예제 #3
0
파일: test.py 프로젝트: pombredanne/httq
 def test_can_read_some_then_all_the_rest_through_content(self):
     http = HTTP(b"httq.io:8080")
     http.get(b"/hello").response()
     assert http.readable()
     assert http.status_code == 200
     assert http.reason == "OK"
     assert http.content_type == "text/plain"
     assert http.readable()
     assert http.read(5) == b"hello"
     assert http.readable()
     assert http.content == "hello, world"
     assert not http.readable()
     assert http.read(5) == b""
     http.close()
예제 #4
0
 def test_can_read_some_then_all_the_rest_through_content(self):
     http = HTTP(b"httq.io:8080")
     http.get(b"/hello").response()
     assert http.readable()
     assert http.status_code == 200
     assert http.reason == "OK"
     assert http.content_type == "text/plain"
     assert http.readable()
     assert http.read(5) == b"hello"
     assert http.readable()
     assert http.content == "hello, world"
     assert not http.readable()
     assert http.read(5) == b""
     http.close()
예제 #5
0
파일: test.py 프로젝트: pombredanne/httq
 def test_can_use_get_method_with_unicode_args(self):
     if sys.version_info >= (3,):
         host = "httq.io:8080"
         path = "/hello"
     else:
         host = "httq.io:8080".decode("utf-8")
         path = "/hello".decode("utf-8")
     http = HTTP(host)
     http.get(path).response()
     assert http.status_code == 200
     assert http.reason == "OK"
     assert http.content_type == "text/plain"
     assert http.readable()
     assert http.content == "hello, world"
     assert not http.readable()
     http.close()
예제 #6
0
 def test_can_use_get_method_with_unicode_args(self):
     if sys.version_info >= (3, ):
         host = "httq.io:8080"
         path = "/hello"
     else:
         host = "httq.io:8080".decode("utf-8")
         path = "/hello".decode("utf-8")
     http = HTTP(host)
     http.get(path).response()
     assert http.status_code == 200
     assert http.reason == "OK"
     assert http.content_type == "text/plain"
     assert http.readable()
     assert http.content == "hello, world"
     assert not http.readable()
     http.close()
예제 #7
0
파일: test.py 프로젝트: pombredanne/httq
 def test_can_read_in_bits(self):
     http = HTTP(b"httq.io:8080")
     http.get(b"/hello").response()
     assert http.readable()
     assert http.status_code == 200
     assert http.reason == "OK"
     assert http.content_type == "text/plain"
     assert http.readable()
     assert http.read(5) == b"hello"
     assert http.readable()
     assert http.read(5) == b", wor"
     assert http.readable()
     assert http.read(5) == b"ld"
     assert not http.readable()
     assert http.read(5) == b""
     assert http.content == "hello, world"
     http.close()
예제 #8
0
 def test_can_read_in_bits(self):
     http = HTTP(b"httq.io:8080")
     http.get(b"/hello").response()
     assert http.readable()
     assert http.status_code == 200
     assert http.reason == "OK"
     assert http.content_type == "text/plain"
     assert http.readable()
     assert http.read(5) == b"hello"
     assert http.readable()
     assert http.read(5) == b", wor"
     assert http.readable()
     assert http.read(5) == b"ld"
     assert not http.readable()
     assert http.read(5) == b""
     assert http.content == "hello, world"
     http.close()
예제 #9
0
파일: test.py 프로젝트: pombredanne/httq
 def test_can_use_head_method_long_hand(self):
     http = HTTP(b"httq.io:8080")
     http.head(b"/hello")
     http.response()
     assert http.status_code == 200
     assert http.reason == "OK"
     assert http.content_type == "text/plain"
     assert not http.readable()
     assert http.content is None
     http.close()