kubatyszko commented on pull request #10256:
URL: https://github.com/apache/airflow/pull/10256#issuecomment-671083935


   I'm reconsider my solution to the issue.
   I think the conn_type always needs to be "http" - meaning protocol, while 
the scheme is supposed to reflect http or https.
   With connection stored as a secret in AWS, and a url like 
"https://foo.bar/SCHEME"; - the scheme would have been populated from the SCHEME 
portion, which is unintuitive and doesn't reflect the URI format at all.
   Going to investigate further whether it's something that needs fixing in the 
http hook or secrets backend.
   
   Also, with my change, this test is failing now:
   
   ```
   ______________________________________________________ 
TestHttpHook.test_https_connection 
______________________________________________________
   
   self = <tests.providers.http.hooks.test_http.TestHttpHook 
testMethod=test_https_connection>
   mock_get_connection = <MagicMock name='get_connection' id='140430833565936'>
   
       @mock.patch('airflow.providers.http.hooks.http.HttpHook.get_connection')
       def test_https_connection(self, mock_get_connection):
           conn = Connection(conn_id='http_default', conn_type='http',
                             host='localhost', schema='https')
           mock_get_connection.return_value = conn
           hook = HttpHook()
           hook.get_conn({})
   >       self.assertEqual(hook.base_url, 'https://localhost')
   E       AssertionError: 'http://localhost' != 'https://localhost'
   E       - http://localhost
   E       + https://localhost
   E       ?     +
   
   test_http.py:305: AssertionError
   ```
   (it succeeds without my change).
   


----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to