NotifyHumHub() bearer token send.
(mock_post)
| 241 | |
| 242 | @mock.patch("requests.post") |
| 243 | def 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") |
nothing calls this directly
no test coverage detected
searching dependent graphs…