ashb commented on a change in pull request #5239: [WIP][AIRFLOW-2910] Add HTTP 
URI support
URL: https://github.com/apache/airflow/pull/5239#discussion_r288037611
 
 

 ##########
 File path: tests/models/test_connection.py
 ##########
 @@ -89,23 +89,37 @@ def test_connection_from_uri_without_extras(self):
         self.assertEqual(connection.conn_type, 'scheme')
         self.assertEqual(connection.host, 'host/location')
         self.assertEqual(connection.schema, 'schema')
-        self.assertEqual(connection.login, 'user')
-        self.assertEqual(connection.password, 'password')
-        self.assertEqual(connection.port, 1234)
+        self.assertIsNone(connection.extra)
+
+    def test_connection_from_http_uri_without_extras(self):
+        uri = 'http://user:password@host%2flocation:1234/schema'
+        connection = Connection(uri=uri)
+        self.assertEqual(connection.conn_type, 'http')
+        self.assertEqual(connection.host, 'http://host%2flocation:1234/schema')
+        self.assertEqual(connection.schema, None)
         self.assertIsNone(connection.extra)
 
     def test_connection_from_uri_with_extras(self):
-        uri = 'scheme://user:password@host%2flocation:1234/schema?' \
-              'extra1=a%20value&extra2=%2fpath%2f'
+        uri = 
'scheme://user:password@host%2flocation:1234/schema?extra1=a%20value&extra2=%2fpath%2f'
         connection = Connection(uri=uri)
         self.assertEqual(connection.conn_type, 'scheme')
         self.assertEqual(connection.host, 'host/location')
         self.assertEqual(connection.schema, 'schema')
         self.assertEqual(connection.login, 'user')
         self.assertEqual(connection.password, 'password')
         self.assertEqual(connection.port, 1234)
-        self.assertDictEqual(connection.extra_dejson, {'extra1': 'a value',
-                                                       'extra2': '/path/'})
+        self.assertDictEqual(connection.extra_dejson, {'extra1': 'a value', 
'extra2': '/path/'})
+
+    def test_connection_from_http_uri_with_extras(self):
+        uri = 
'http://user:password@host%2flocation:1234/schema#extra1=a%20value&extra2=%2fpath%2f'
+        connection = Connection(uri=uri)
+        self.assertEqual(connection.conn_type, 'http')
+        self.assertEqual(connection.host, 'http://host%2flocation:1234/schema')
 
 Review comment:
   This doesn't look like a "sensible" host value - is % even allowed in 
hostnames?

----------------------------------------------------------------
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

Reply via email to