MCPcopy
hub / github.com/caronc/apprise / test_plugin_humhub_bearer_send

Function test_plugin_humhub_bearer_send

tests/test_plugin_humhub.py:243–259  ·  view source on GitHub ↗

NotifyHumHub() bearer token send.

(mock_post)

Source from the content-addressed store, hash-verified

241
242@mock.patch("requests.post")
243def test_plugin_humhub_bearer_send(mock_post):
244 """NotifyHumHub() bearer token send."""
245
246 # Successful response
247 mock_post.return_value = requests.Request()
248 mock_post.return_value.status_code = requests.codes.ok
249 mock_post.return_value.content = b""
250
251 obj = NotifyHumHub(user="mytoken", host="localhost", targets=["1"])
252 assert obj.notify(body="Test body") is True
253
254 # Confirm bearer token header was set
255 assert mock_post.called
256 _, kwargs = mock_post.call_args
257 assert "Authorization" in kwargs.get("headers", {})
258 assert kwargs["headers"]["Authorization"] == "Bearer mytoken"
259 assert kwargs.get("auth") is None
260
261
262@mock.patch("requests.post")

Callers

nothing calls this directly

Calls 3

NotifyHumHubClass · 0.90
notifyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…