Test to ensure it's possible to quickly change the default hug output format
()
| 819 | |
| 820 | @pytest.mark.skipif(sys.platform == "win32", reason="Currently failing on Windows build") |
| 821 | def 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") |
nothing calls this directly
no test coverage detected