You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by hu...@apache.org on 2023/07/12 00:02:29 UTC

[airflow] branch main updated: Improve the readability of the conn view tests (#32529)

This is an automated email from the ASF dual-hosted git repository.

husseinawala pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 46715164ca Improve the readability of the conn view tests (#32529)
46715164ca is described below

commit 46715164caf2fadf698f28f1a54443f58b9eb5e8
Author: Hussein Awala <hu...@awala.fr>
AuthorDate: Wed Jul 12 02:02:22 2023 +0200

    Improve the readability of the conn view tests (#32529)
---
 tests/www/views/test_views_connection.py | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tests/www/views/test_views_connection.py b/tests/www/views/test_views_connection.py
index 1897db364b..c7698e3b7c 100644
--- a/tests/www/views/test_views_connection.py
+++ b/tests/www/views/test_views_connection.py
@@ -344,16 +344,17 @@ def test_duplicate_connection(admin_client):
 
     data = {"action": "mulduplicate", "rowid": [conn1.id, conn3.id]}
     resp = admin_client.post("/connection/action_post", data=data, follow_redirects=True)
-    expected_result = {
+    assert resp.status_code == 200
+
+    expected_connections_ids = {
         "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
+    connections_ids = {conn.conn_id for conn in session.query(Connection.conn_id)}
+    assert expected_connections_ids == connections_ids
 
 
 def test_duplicate_connection_error(admin_client):
@@ -380,12 +381,11 @@ def test_duplicate_connection_error(admin_client):
 
     data = {"action": "mulduplicate", "rowid": [connections[0].id]}
     resp = admin_client.post("/connection/action_post", data=data, follow_redirects=True)
-
-    expected_result = {f"test_duplicate_postgres_connection_copy{i}" for i in range(1, 11)}
-
     assert resp.status_code == 200
-    response = {conn[0] for conn in session.query(Connection.conn_id).all()}
-    assert expected_result == response
+
+    expected_connections_ids = {f"test_duplicate_postgres_connection_copy{i}" for i in range(1, 11)}
+    connections_ids = {conn.conn_id for conn in session.query(Connection.conn_id)}
+    assert expected_connections_ids == connections_ids
 
 
 @pytest.fixture()