def test_execute_timeout(self, mock_hook):
     operator = PubSubPullSensor(task_id=TASK_ID, project=TEST_PROJECT,
                                 subscription=TEST_SUBSCRIPTION,
                                 poke_interval=0, timeout=1)
     mock_hook.return_value.pull.return_value = []
     with self.assertRaises(AirflowSensorTimeout):
         operator.execute(None)
         mock_hook.return_value.pull.assert_called_with(
             TEST_PROJECT, TEST_SUBSCRIPTION, 5, False)
 def test_execute_timeout(self, mock_hook):
     operator = PubSubPullSensor(task_id=TASK_ID, project=TEST_PROJECT,
                                 subscription=TEST_SUBSCRIPTION,
                                 poke_interval=0, timeout=1)
     mock_hook.return_value.pull.return_value = []
     with self.assertRaises(AirflowSensorTimeout):
         operator.execute(None)
         mock_hook.return_value.pull.assert_called_with(
             TEST_PROJECT, TEST_SUBSCRIPTION, 5, False)
 def test_execute(self, mock_hook):
     operator = PubSubPullSensor(task_id=TASK_ID, project=TEST_PROJECT,
                                 subscription=TEST_SUBSCRIPTION,
                                 poke_interval=0)
     generated_messages = self._generate_messages(5)
     mock_hook.return_value.pull.return_value = generated_messages
     response = operator.execute(None)
     mock_hook.return_value.pull.assert_called_with(
         TEST_PROJECT, TEST_SUBSCRIPTION, 5, False)
     self.assertEquals(response, generated_messages)
 def test_execute(self, mock_hook):
     operator = PubSubPullSensor(task_id=TASK_ID, project=TEST_PROJECT,
                                 subscription=TEST_SUBSCRIPTION,
                                 poke_interval=0)
     generated_messages = self._generate_messages(5)
     mock_hook.return_value.pull.return_value = generated_messages
     response = operator.execute(None)
     mock_hook.return_value.pull.assert_called_with(
         TEST_PROJECT, TEST_SUBSCRIPTION, 5, False)
     self.assertEquals(response, generated_messages)