示例#1
0
文件: test.py 项目: pombredanne/httq
 def test_can_post_json_in_chunks(self):
     http = HTTP(b"httq.io:8080")
     http.post(b"/json?foo=bar")
     http.write(b"bum")
     http.write(b"ble")
     http.write(b"bee")
     http.write(b"")
     response = http.response()
     content = response.content
     assert content == {"method": "POST", "query": "foo=bar", "content": "bumblebee"}
示例#2
0
 def test_can_post_json_in_chunks(self):
     http = HTTP(b"httq.io:8080")
     http.post(b"/json?foo=bar")
     http.write(b"bum")
     http.write(b"ble")
     http.write(b"bee")
     http.write(b"")
     response = http.response()
     content = response.content
     assert content == {
         "method": "POST",
         "query": "foo=bar",
         "content": "bumblebee"
     }
示例#3
0
 def test_can_post_dict_as_json(self):
     http = HTTP(b"httq.io:8080")
     response = http.post(b"/json?foo=bar", {"bee": "bumble"}).response()
     content = response.content
     assert content == {
         "method": "POST",
         "query": "foo=bar",
         "content": '{"bee": "bumble"}'
     }
示例#4
0
文件: test.py 项目: pombredanne/httq
 def test_can_post_dict_as_json(self):
     http = HTTP(b"httq.io:8080")
     response = http.post(b"/json?foo=bar", {"bee": "bumble"}).response()
     content = response.content
     assert content == {"method": "POST", "query": "foo=bar", "content": '{"bee": "bumble"}'}