utkarsharma2 commented on a change in pull request #9907:
URL: https://github.com/apache/airflow/pull/9907#discussion_r467492937



##########
File path: airflow/cli/commands/connection_command.py
##########
@@ -153,3 +155,93 @@ def connections_delete(args):
             msg = '\n\tSuccessfully deleted `conn_id`={conn_id}\n'
             msg = msg.format(conn_id=deleted_conn_id)
             print(msg)
+
+
+DIS_RESTRICT = 'restrict'
+DIS_OVERWRITE = 'overwrite'
+DIS_IGNORE = 'ignore'
+CREATED = 'created'
+DISPOSITIONS = [DIS_RESTRICT, DIS_OVERWRITE, DIS_IGNORE]
+
+
+def prep_import_status_msgs(conn_status_map):
+    msg = "\n"
+    for status, conn_list in conn_status_map.items():
+        if len(conn_list) > 0:
+            msg = msg + status + " : \n\t"
+            for conn in conn_list:
+                msg = msg + '\n\t`conn_id`={conn_id} : {uri}\n'
+                msg = msg.format(conn_id=conn.conn_id,

Review comment:
       @mik-laj, I have created a new function to prepare a status message, 
after which I found a few test cases to be failing:
   
   - **TestCliAddConnections.test_cli_connection_add_0** : \tSuccessfully added 
`conn_id`=new0 : postgresql://airflow:airflow@host:5432/airflow' not found in 
'\n\tSuccessfully added `conn_id`=new0 : 
postgres://airflow:airflow@host:5432/airflow\n\n
   
   - **TestCliAddConnections.test_cli_connection_add_1** : \tSuccessfully added 
`conn_id`=new1 : postgresql://airflow:airflow@host:5432/airflow' not found in 
'\n\tSuccessfully added `conn_id`=new1 : 
postgres://airflow:airflow@host:5432/airflow\n\n
   
   - **TestCliAddConnections.test_cli_connection_add_4** :  \tSuccessfully 
added `conn_id`=new4 : hive_metastore://airflow:******@host:9083/airflow' not 
found in '\n\tSuccessfully added `conn_id`=new4 : 
hive-metastore://airflow:airflow@host:9083/airflow\n\n
   
   - **TestCliAddConnections.test_cli_connection_add_5** : \tSuccessfully added 
`conn_id`=new5 : google_cloud_platform://:@:' not found in '\n\tSuccessfully 
added `conn_id`=new5 : google-cloud-platform://\n\n
   
   The reason for this is earlier we were using the value of args.conn_uri and 
now since this method is common and args is not having the same value when 
called from connections_import() method, I have updated it with conn.get_uri(), 
where conn is a connection object. 
   
   So is this okay? and if so should we update test cases?




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


Reply via email to