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

potiuk 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 3931394  Issue 20453 - Fixes the test_http and test_sheets assert 
calls only (#22104)
3931394 is described below

commit 393139449a54bd3afe6f59448ea8c63510830f76
Author: Harish Kesava Rao <harish.kesava...@gmail.com>
AuthorDate: Sun Mar 13 18:57:09 2022 -0700

    Issue 20453 - Fixes the test_http and test_sheets assert calls only (#22104)
---
 tests/providers/google/suite/operators/test_sheets.py | 9 +++------
 tests/providers/http/operators/test_http.py           | 6 ++----
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/tests/providers/google/suite/operators/test_sheets.py 
b/tests/providers/google/suite/operators/test_sheets.py
index 0bf2da4..c67ef41 100644
--- a/tests/providers/google/suite/operators/test_sheets.py
+++ b/tests/providers/google/suite/operators/test_sheets.py
@@ -39,12 +39,9 @@ class TestGoogleSheetsCreateSpreadsheet:
         op = GoogleSheetsCreateSpreadsheetOperator(
             task_id="test_task", spreadsheet=spreadsheet, 
gcp_conn_id=GCP_CONN_ID
         )
-        op.execute(context)
+        op_execute_result = op.execute(context)
 
         
mock_hook.return_value.create_spreadsheet.assert_called_once_with(spreadsheet=spreadsheet)
 
-        calls = [
-            mock.call(context, "spreadsheet_id", SPREADSHEET_ID),
-            mock.call(context, "spreadsheet_url", SPREADSHEET_URL),
-        ]
-        mock_xcom.has_calls(calls)
+        assert op_execute_result['spreadsheetId'] == '1234567890'
+        assert op_execute_result['spreadsheetUrl'] == 'https://example/sheets'
diff --git a/tests/providers/http/operators/test_http.py 
b/tests/providers/http/operators/test_http.py
index d4c622c..c4e342c 100644
--- a/tests/providers/http/operators/test_http.py
+++ b/tests/providers/http/operators/test_http.py
@@ -44,10 +44,8 @@ class TestSimpleHttpOp(unittest.TestCase):
             log_response=True,
         )
 
-        with mock.patch.object(operator.log, 'info') as mock_info:
-            operator.execute(None)
-            calls = [mock.call('Example.com fake response'), 
mock.call('Example.com fake response')]
-            mock_info.has_calls(calls)
+        result = operator.execute('Example.com fake response')
+        assert result == 'Example.com fake response'
 
     @requests_mock.mock()
     def test_response_in_logs_after_failed_check(self, m):

Reply via email to