You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2021/03/19 22:02:31 UTC

[airflow] 03/04: Fix tests in tests/www/test_views.py (#14719)

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

kaxilnaik pushed a commit to branch v2-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit b22fa04e6ba0b05857e4ce8c220ec18e567a8f47
Author: Kaxil Naik <ka...@gmail.com>
AuthorDate: Thu Mar 11 16:50:19 2021 +0000

    Fix tests in tests/www/test_views.py (#14719)
    
    One of tests fixed in (#14710) had an usused variable - `expected_url`,
    copy/paste failure. This commit fixes it and adds a condition too to
    only replace url if it contains a semi-colon
    
    (cherry picked from commit 52604a3444e4473f5c20f56624624869ea50ef9b)
---
 tests/www/test_views.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/www/test_views.py b/tests/www/test_views.py
index ce4478c..c8ced89 100644
--- a/tests/www/test_views.py
+++ b/tests/www/test_views.py
@@ -2769,9 +2769,9 @@ class TestTriggerDag(TestBase):
         # https://github.com/python/cpython/pull/24297/files
         # Check if tests are running with a Python version containing the above fix
         # where ";" is removed as a separator
-        if parse_qsl(";a=b") != [(';a', 'b')]:
-            expected_url = expected_origin.replace("%3B", "&")
-            expected_url += "="
+        if parse_qsl(";a=b") != [(';a', 'b')] and ";" in test_origin:
+            expected_origin = expected_origin.replace("%3B", "&")
+            expected_origin += "="
 
         resp = self.client.get(f'trigger?dag_id={test_dag_id}&origin={test_origin}')
         self.check_content_in_response(
@@ -3318,7 +3318,7 @@ class TestHelperFunctions(TestBase):
         # https://github.com/python/cpython/pull/24297/files
         # Check if tests are running with a Python version containing the above fix
         # where ";" is removed as a separator
-        if parse_qsl(";a=b") != [(';a', 'b')]:
+        if parse_qsl(";a=b") != [(';a', 'b')] and ";" in test_url:
             expected_url = expected_url.replace("%3B", "&")
             expected_url += "="