NotifyHumHub() basic auth send.
(mock_post)
| 261 | |
| 262 | @mock.patch("requests.post") |
| 263 | def 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") |
nothing calls this directly
no test coverage detected
searching dependent graphs…