MCPcopy Create free account
hub / github.com/authlib/authlib / test_binary_upload

Function test_binary_upload

tests/clients/test_requests/test_oauth1_session.py:100–112  ·  view source on GitHub ↗
(generate_nonce, generate_timestamp)

Source from the content-addressed store, hash-verified

98@mock.patch("authlib.oauth1.rfc5849.client_auth.generate_timestamp")
99@mock.patch("authlib.oauth1.rfc5849.client_auth.generate_nonce")
100def test_binary_upload(generate_nonce, generate_timestamp):
101 generate_nonce.return_value = "abc"
102 generate_timestamp.return_value = "123"
103 fake_xml = StringIO("hello world")
104 headers = {"Content-Type": "application/xml"}
105
106 def fake_send(r, **kwargs):
107 auth_header = r.headers["Authorization"]
108 assert "oauth_body_hash" in auth_header
109
110 auth = OAuth1Session("foo", force_include_body=True)
111 auth.send = fake_send
112 auth.post("https://provider.test", headers=headers, files=[("fake", fake_xml)])
113
114
115@mock.patch("authlib.oauth1.rfc5849.client_auth.generate_timestamp")

Callers

nothing calls this directly

Calls 2

OAuth1SessionClass · 0.90
postMethod · 0.80

Tested by

no test coverage detected