ashb commented on a change in pull request #5173: AIRFLOW-4295. Make comparison
of `method` case insensitive in HttpHook
URL: https://github.com/apache/airflow/pull/5173#discussion_r278139451
##########
File path: tests/hooks/test_http_hook.py
##########
@@ -131,6 +132,28 @@ def test_hook_contains_header_from_extra_field(self, m):
self.assertDictContainsSubset(json.loads(expected_conn.extra),
conn.headers)
self.assertEqual(conn.headers.get('bareer'), 'test')
+ @requests_mock.mock()
+ @mock.patch('requests.Request')
+ def test_hook_with_method_in_lowercase(self, m, request_mock):
+ from requests.exceptions import MissingSchema
+ with mock.patch(
+ 'airflow.hooks.base_hook.BaseHook.get_connection',
+ side_effect=get_airflow_connection_with_port
+ ):
+ data = "test params"
+ try:
+ self.get_lowercase_hook.run('v1/test', data=data)
+ except MissingSchema:
+ pass
+ request_mock.assert_called_once_with(
+ mock.ANY,
+ mock.ANY,
+ headers=mock.ANY,
+ params=data
+ )
+
+
+
Review comment:
Flake8 says there must be only one blank line between methods.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services