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 2019/04/15 15:56:21 UTC

[GitHub] [airflow] feluelle commented on a change in pull request #5104: [AIRFLOW-4320] Add tests for SegmentTrackEventOperator

feluelle commented on a change in pull request #5104: [AIRFLOW-4320] Add tests for SegmentTrackEventOperator
URL: https://github.com/apache/airflow/pull/5104#discussion_r275430678
 
 

 ##########
 File path: tests/contrib/operators/test_segment_track_event_operator.py
 ##########
 @@ -60,5 +62,28 @@ def test_on_error(self):
             self.test_hook.on_error('error', ['items'])
 
 
+class SegmentTrackEventOperatorTest(unittest.TestCase):
+
+    @mock.patch('airflow.contrib.operators.segment_track_event_operator.SegmentHook')
+    def test_execute(self, mock_hook):
+        user_id = 'user_id'
+        event = 'event'
+        properties = {}
+
+        operator = SegmentTrackEventOperator(
+            task_id='segment-track',
+            user_id=user_id,
+            event=event,
+            properties=properties,
+        )
+
+        operator.execute(None)
 
 Review comment:
   I personally split a test into 3 blocks.
   
   First block for preparation of the objects you want to test.
   Second block for the actual operation you want to test.
   Third block for assertions.
   
   So I would move the `operator.execute(None)` to the second block.
   
   Just my preference. I am fine with yours, too. :)

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services