subkanthi commented on pull request #18161:
URL: https://github.com/apache/airflow/pull/18161#issuecomment-934892074


   > OK. Ping us when there are tests :)
   
   There is a test in test_views_connection.py that tests the duplication 
logic, I can add one more to test the logic of erroring out when 10 connections 
already exists.
   
   `def test_duplicate_connection(admin_client):
       """Test Duplicate multiple connection with suffix"""
       conn1 = Connection(
           conn_id='test_duplicate_gcp_connection',
           conn_type='Google Cloud',
           description='Google Cloud Connection',
       )
       conn2 = Connection(
           conn_id='test_duplicate_mysql_connection',
           conn_type='FTP',
           description='MongoDB2',
           host='localhost',
           schema='airflow',
           port=3306,
       )
       conn3 = Connection(
           conn_id='test_duplicate_postgres_connection_copy1',
           conn_type='FTP',
           description='Postgres',
           host='localhost',
           schema='airflow',
           port=3306,
       )
       with create_session() as session:
           session.query(Connection).delete()
           session.add_all([conn1, conn2, conn3])
           session.commit()
   
       data = {"action": "mulduplicate", "rowid": [conn1.id, conn3.id]}
       resp = admin_client.post('/connection/action_post', data=data, 
follow_redirects=True)
       expected_result = {
           'test_duplicate_gcp_connection',
           'test_duplicate_gcp_connection_copy1',
           'test_duplicate_mysql_connection',
           'test_duplicate_postgres_connection_copy1',
           'test_duplicate_postgres_connection_copy2',
       }
       response = {conn[0] for conn in session.query(Connection.conn_id).all()}
       assert resp.status_code == 200
       assert expected_result == response`


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


Reply via email to