MCPcopy Index your code
hub / github.com/hugapi/hug / test_input_format

Function test_input_format

tests/test_decorators.py:821–838  ·  view source on GitHub ↗

Test to ensure it's possible to quickly change the default hug output format

()

Source from the content-addressed store, hash-verified

819
820@pytest.mark.skipif(sys.platform == "win32", reason="Currently failing on Windows build")
821def test_input_format():
822 """Test to ensure it's possible to quickly change the default hug output format"""
823 old_format = api.http.input_format("application/json")
824 api.http.set_input_format("application/json", lambda a, **headers: {"no": "relation"})
825
826 @hug.get()
827 def hello(body):
828 return body
829
830 assert hug.test.get(api, "hello", body={"should": "work"}).data == {"no": "relation"}
831
832 @hug.get()
833 def hello2(body):
834 return body
835
836 assert not hug.test.get(api, "hello2").data
837
838 api.http.set_input_format("application/json", old_format)
839
840
841@pytest.mark.skipif(sys.platform == "win32", reason="Currently failing on Windows build")

Callers

nothing calls this directly

Calls 3

input_formatMethod · 0.80
set_input_formatMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected