You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/03/09 03:03:22 UTC

[GitHub] [airflow] harishkrao opened a new pull request #22104: Issue 20453 - Fixes the test_http and test_sheets assert calls only

harishkrao opened a new pull request #22104:
URL: https://github.com/apache/airflow/pull/22104


   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   The PR contains fixes for part of the issues listed in the issue #20453. It fixes the tests for the providers - Google Sheets and Simple Http only. I will be submitting more PRs for the remaining open issues for #20453.
   
   related: #20453 
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/main/UPDATING.md).
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] harishkrao commented on pull request #22104: Issue 20453 - Fixes the test_http and test_sheets assert calls only

Posted by GitBox <gi...@apache.org>.
harishkrao commented on pull request #22104:
URL: https://github.com/apache/airflow/pull/22104#issuecomment-1065948819


   > @potiuk @mik-laj @kaxil if you have time, can you please review the PR? If you are busy and can suggest other reviewers, that is great too. Thank you!
   @potiuk Just wanted to bump this up, when you have a moment.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] uranusjr commented on a change in pull request #22104: Issue 20453 - Fixes the test_http and test_sheets assert calls only

Posted by GitBox <gi...@apache.org>.
uranusjr commented on a change in pull request #22104:
URL: https://github.com/apache/airflow/pull/22104#discussion_r825385622



##########
File path: tests/providers/google/suite/operators/test_sheets.py
##########
@@ -39,12 +39,9 @@ def test_execute(self, mock_xcom, mock_hook):
         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'

Review comment:
       Does `op_execute_result` contain other values? We should try to verify the _entire_ dict if possible.




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] harishkrao commented on pull request #22104: Issue 20453 - Fixes the test_http and test_sheets assert calls only

Posted by GitBox <gi...@apache.org>.
harishkrao commented on pull request #22104:
URL: https://github.com/apache/airflow/pull/22104#issuecomment-1062528559


   @potiuk @mik-laj if you have time, can you please review the PR? If you are busy and can suggest other reviewers, that is great too. Thank you!


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] harishkrao commented on a change in pull request #22104: Issue 20453 - Fixes the test_http and test_sheets assert calls only

Posted by GitBox <gi...@apache.org>.
harishkrao commented on a change in pull request #22104:
URL: https://github.com/apache/airflow/pull/22104#discussion_r825407008



##########
File path: tests/providers/google/suite/operators/test_sheets.py
##########
@@ -39,12 +39,9 @@ def test_execute(self, mock_xcom, mock_hook):
         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'

Review comment:
       I just printed the dict entirely and saw that these are the only two values the `GoogleSheetsCreateSpreadsheetOperator`'s execute call returns. 
   The dict looks like this: `{'spreadsheetId': '1234567890', 'spreadsheetUrl': 'https://example/sheets'}`. 




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] harishkrao edited a comment on pull request #22104: Issue 20453 - Fixes the test_http and test_sheets assert calls only

Posted by GitBox <gi...@apache.org>.
harishkrao edited a comment on pull request #22104:
URL: https://github.com/apache/airflow/pull/22104#issuecomment-1062528559


   @potiuk @mik-laj @kaxil if you have time, can you please review the PR? If you are busy and can suggest other reviewers, that is great too. Thank you!


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] harishkrao commented on a change in pull request #22104: Issue 20453 - Fixes the test_http and test_sheets assert calls only

Posted by GitBox <gi...@apache.org>.
harishkrao commented on a change in pull request #22104:
URL: https://github.com/apache/airflow/pull/22104#discussion_r825394693



##########
File path: tests/providers/google/suite/operators/test_sheets.py
##########
@@ -39,12 +39,9 @@ def test_execute(self, mock_xcom, mock_hook):
         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'

Review comment:
       Thank you, I will write the entire dict's results and write more tests wherever appropriate.




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] harishkrao commented on a change in pull request #22104: Issue 20453 - Fixes the test_http and test_sheets assert calls only

Posted by GitBox <gi...@apache.org>.
harishkrao commented on a change in pull request #22104:
URL: https://github.com/apache/airflow/pull/22104#discussion_r825394693



##########
File path: tests/providers/google/suite/operators/test_sheets.py
##########
@@ -39,12 +39,9 @@ def test_execute(self, mock_xcom, mock_hook):
         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'

Review comment:
       Thank you, I will write the entire dict's results and write more tests wherever appropriate.




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk merged pull request #22104: Issue 20453 - Fixes the test_http and test_sheets assert calls only

Posted by GitBox <gi...@apache.org>.
potiuk merged pull request #22104:
URL: https://github.com/apache/airflow/pull/22104


   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org