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

Function test_plugin_humhub_basic_send

tests/test_plugin_humhub.py:263–280  ·  view source on GitHub ↗

NotifyHumHub() basic auth send.

(mock_post)

Source from the content-addressed store, hash-verified

261
262@mock.patch("requests.post")
263def test_plugin_humhub_basic_send(mock_post):
264 """NotifyHumHub() basic auth send."""
265
266 # Successful response
267 mock_post.return_value = requests.Request()
268 mock_post.return_value.status_code = requests.codes.ok
269 mock_post.return_value.content = b""
270
271 obj = NotifyHumHub(
272 user="admin", password="secret", host="localhost", targets=["1"]
273 )
274 assert obj.notify(body="Test body") is True
275
276 # Confirm basic auth tuple was passed and no Authorization header
277 assert mock_post.called
278 _, kwargs = mock_post.call_args
279 assert kwargs.get("auth") == ("admin", "secret")
280 assert "Authorization" not in kwargs.get("headers", {})
281
282
283@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…