Esempio n. 1
0
 def test_decode_body_json_no_charset(self):
     body = b'{"test-string":"hello","test-bool":true}'
     headers = {"content-type": "application/json"}
     decoded_body = sansio.decode_body(headers, body)
     assert decoded_body == {"test-string": "hello", "test-bool": True}
Esempio n. 2
0
 def test_decode_body_string_ok(self):
     body = b"ok"
     decoded_body = sansio.decode_body({}, body)
     assert decoded_body == {"ok": True}
Esempio n. 3
0
 def test_decode_body_string_nok(self):
     body = b"hello world"
     decoded_body = sansio.decode_body({}, body)
     assert decoded_body == {"ok": False, "data": "hello world"}
Esempio n. 4
0
 def test_decode_body(self):
     body = b"hello world"
     decoded_body = sansio.decode_body({}, body)
     assert decoded_body == "hello world"