Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add means to Duplicate connections from UI #15574

Merged
merged 30 commits into from
Jun 17, 2021
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
32d8d64
12401 - added changes in view.py to duplicate connections
pateash Apr 28, 2021
dd68fb8
12401 - pylint error fixed
pateash Apr 28, 2021
20d0532
12401 - test added
pateash Apr 28, 2021
7349a40
12401 - pylint fixed
pateash Apr 28, 2021
ece3352
Merge branch 'master' of https://github.com/apache/airflow into #1240…
pateash May 1, 2021
04750aa
12401 - test added
pateash May 4, 2021
5adfd66
Update tests/www/test_views.py
pateash May 4, 2021
ba7b9ef
12401 - removed formatting
pateash May 4, 2021
85edcc0
Merge branch '#12401-creating-duplicate-connection-in-ui' of https://…
pateash May 4, 2021
a6974bc
Merge branch 'master' of https://github.com/apache/airflow into #1240…
pateash May 4, 2021
d57bee9
Update test_views.py
pateash May 4, 2021
5e7b6d3
Create test_views.py
pateash May 4, 2021
3f04aea
12401 - fixed intermediate matching and used _copyN
pateash May 4, 2021
dfedd9d
Merge remote-tracking branch 'ap/#12401-creating-duplicate-connection…
pateash May 4, 2021
08fcd82
12401 - test implemented
pateash May 4, 2021
86853ac
12401 - test fixed
pateash May 5, 2021
038c1a6
12401 - re.search() used instead of findall()
pateash May 5, 2021
e4370b9
12401 - pylint fixed
pateash May 5, 2021
1372eb9
12401 - variable name changed as per suggestion.
pateash May 5, 2021
a5104b1
Update airflow/www/views.py
pateash May 5, 2021
1ab9f8a
Merge branch '#12401-creating-duplicate-connection-in-ui' of https://…
pateash May 5, 2021
d55c15d
12401 - variable name changed as per suggestion.
pateash May 5, 2021
06d1932
12401 - pylint fixed
pateash May 5, 2021
7014a50
Merge branch 'master' of https://github.com/apache/airflow into #1240…
pateash May 11, 2021
7281040
12401 - refactoring done as per new test refactoring.
pateash May 11, 2021
582347c
12401 - mock_form is not needed for now.
pateash May 11, 2021
43a0443
Merge branch 'main' into #12401-creating-duplicate-connection-in-ui
pateash Jun 2, 2021
2171c62
Update airflow/www/views.py
pateash Jun 12, 2021
ab22173
12401 - fixed pylint issue
pateash Jun 14, 2021
ac6841c
Merge branch 'main' of https://github.com/apache/airflow into #12401-…
pateash Jun 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions tests/www/views/test_views_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,46 @@ def test_prefill_form_null_extra():

cmv = ConnectionModelView()
cmv.prefill_form(form=mock_form, pk=1)


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()
pateash marked this conversation as resolved.
Show resolved Hide resolved

mock_form = mock.Mock()
mock_form.data = {"action": "mulduplicate", "rowid": [conn1.id, conn3.id]}
resp = admin_client.post('/connection/action_post', data=mock_form.data, follow_redirects=True)
pateash marked this conversation as resolved.
Show resolved Hide resolved
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