kaxil commented on a change in pull request #16512:
URL: https://github.com/apache/airflow/pull/16512#discussion_r653928131
##########
File path: tests/providers/apache/livy/hooks/test_livy.py
##########
@@ -316,6 +316,20 @@ def test_invalid_uri(self):
with pytest.raises(RequestException):
hook.post_batch(file='sparkapp')
+ @requests_mock.mock()
+ def test_extra_headers(self, mock):
+ mock.register_uri(
+ 'POST',
+ '//livy:8998/batches',
+ json={'id': BATCH_ID, 'state': BatchState.STARTING.value, 'log':
[]},
+ status_code=201,
+ request_headers={'X-Requested-By': 'user'}
+ )
+
+ hook = LivyHook(extra_headers={'X-Requested-By': 'user'})
+ hook.post_batch(file='sparkapp')
+
Review comment:
What does this test check?
##########
File path: tests/providers/apache/livy/hooks/test_livy.py
##########
@@ -316,6 +316,20 @@ def test_invalid_uri(self):
with pytest.raises(RequestException):
hook.post_batch(file='sparkapp')
+ @requests_mock.mock()
+ def test_extra_headers(self, mock):
+ mock.register_uri(
+ 'POST',
+ '//livy:8998/batches',
+ json={'id': BATCH_ID, 'state': BatchState.STARTING.value, 'log':
[]},
+ status_code=201,
+ request_headers={'X-Requested-By': 'user'}
+ )
+
+ hook = LivyHook(extra_headers={'X-Requested-By': 'user'})
+ hook.post_batch(file='sparkapp')
+
Review comment:
Tested it locally, works fine
--
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]