From 6c0151ab67917c01182b25e410feb4332c74471d Mon Sep 17 00:00:00 2001 From: Alena Volkova Date: Fri, 2 Mar 2018 18:27:10 -0500 Subject: [PATCH] bot testing: Allow mocking PATCH HTTP requests. --- zulip_bots/zulip_bots/request_test_lib.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/zulip_bots/zulip_bots/request_test_lib.py b/zulip_bots/zulip_bots/request_test_lib.py index 561d5d6..e8651f1 100644 --- a/zulip_bots/zulip_bots/request_test_lib.py +++ b/zulip_bots/zulip_bots/request_test_lib.py @@ -62,6 +62,15 @@ def mock_http_conversation(http_data): http_request, ['params', 'headers'] ) + elif http_method == 'PATCH': + with patch('requests.patch') as mock_patch: + mock_patch.return_value = get_response(http_response, http_headers) + yield + assert_called_with_fields( + mock_patch, + http_request, + ['params', 'headers', 'json', 'data'] + ) else: with patch('requests.post') as mock_post: mock_post.return_value = get_response(http_response, http_headers)