alejorodriguez96 commented on code in PR #37696:
URL: https://github.com/apache/airflow/pull/37696#discussion_r1502419010
##########
airflow/providers/http/hooks/http.py:
##########
@@ -38,6 +38,14 @@
from airflow.models import Connection
+def _url_from_endpoint(base_url: str | None, endpoint: str | None) -> str:
+ """Combine base url with endpoint."""
+ print(f"base_url: {base_url}, endpoint: {endpoint}")
Review Comment:
sorry debugging print left on code, fixed!
##########
tests/providers/http/hooks/test_http.py:
##########
@@ -648,3 +648,25 @@ def test_process_extra_options_from_connection(self):
"max_redirects": 3,
}
assert actual == {"bearer": "test"}
+
+ @pytest.mark.asyncio
+ async def test_build_request_url_from_connection(self):
+ conn = get_airflow_connection()
+ schema = conn.schema or "http" # default to http
+ with mock.patch("airflow.hooks.base.BaseHook.get_connection",
side_effect=get_airflow_connection):
+ hook = HttpAsyncHook()
+ with mock.patch("aiohttp.ClientSession.post",
new_callable=mock.AsyncMock) as mocked_function:
+ await hook.run("v1/test")
+ assert mocked_function.call_args.args[0] == schema + "://" +
conn.host + "v1/test"
Review Comment:
done! ty
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]