MCPcopy
hub / github.com/psf/requests / test_POSTBIN_GET_POST_FILES

Method test_POSTBIN_GET_POST_FILES

tests/test_requests.py:818–833  ·  view source on GitHub ↗
(self, httpbin)

Source from the content-addressed store, hash-verified

816 assert '"auth"' in r.request.headers["Authorization"]
817
818 def test_POSTBIN_GET_POST_FILES(self, httpbin):
819 url = httpbin("post")
820 requests.post(url).raise_for_status()
821
822 post1 = requests.post(url, data={"some": "data"})
823 assert post1.status_code == 200
824
825 with open("requirements-dev.txt") as f:
826 post2 = requests.post(url, files={"some": f})
827 assert post2.status_code == 200
828
829 post4 = requests.post(url, data='[{"some": "json"}]')
830 assert post4.status_code == 200
831
832 with pytest.raises(ValueError):
833 requests.post(url, files=["bad file data"])
834
835 def test_invalid_files_input(self, httpbin):
836 url = httpbin("post")

Callers

nothing calls this directly

Calls 3

httpbinFunction · 0.85
raise_for_statusMethod · 0.80
postMethod · 0.80

Tested by

no test coverage detected