Fix: correctly handle dict data with webhook (#9674)

This commit is contained in:
shamoon 2025-04-16 00:07:08 -07:00 committed by GitHub
parent 67a97ffc4d
commit df5af5c8ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 37 additions and 13 deletions

View file

@ -2614,7 +2614,7 @@ class TestWorkflows(
)
mock_post.assert_called_once_with(
"http://paperless-ngx.com",
url="http://paperless-ngx.com",
content="Test message",
headers={},
files=None,
@ -2623,6 +2623,20 @@ class TestWorkflows(
expected_str = "Webhook sent to http://paperless-ngx.com"
self.assertIn(expected_str, cm.output[0])
# with dict
send_webhook(
url="http://paperless-ngx.com",
data={"message": "Test message"},
headers={},
files=None,
)
mock_post.assert_called_with(
url="http://paperless-ngx.com",
data={"message": "Test message"},
headers={},
files=None,
)
@mock.patch("httpx.post")
def test_workflow_webhook_send_webhook_retry(self, mock_http):
mock_http.return_value.raise_for_status = mock.Mock(