def test_poke_with_ack_messages(self, mock_hook):
     operator = PubSubPullSensor(task_id=TASK_ID, project=TEST_PROJECT,
                                 subscription=TEST_SUBSCRIPTION,
                                 ack_messages=True)
     generated_messages = self._generate_messages(5)
     mock_hook.return_value.pull.return_value = generated_messages
     self.assertEquals(generated_messages, operator.poke(None))
     mock_hook.return_value.acknowledge.assert_called_with(
         TEST_PROJECT, TEST_SUBSCRIPTION, ['1', '2', '3', '4', '5']
     )
 def test_poke_with_ack_messages(self, mock_hook):
     operator = PubSubPullSensor(task_id=TASK_ID, project=TEST_PROJECT,
                                 subscription=TEST_SUBSCRIPTION,
                                 ack_messages=True)
     generated_messages = self._generate_messages(5)
     mock_hook.return_value.pull.return_value = generated_messages
     self.assertEquals(generated_messages, operator.poke(None))
     mock_hook.return_value.acknowledge.assert_called_with(
         TEST_PROJECT, TEST_SUBSCRIPTION, ['1', '2', '3', '4', '5']
     )
 def test_poke_no_messages(self, mock_hook):
     operator = PubSubPullSensor(task_id=TASK_ID, project=TEST_PROJECT,
                                 subscription=TEST_SUBSCRIPTION)
     mock_hook.return_value.pull.return_value = []
     self.assertEquals([], operator.poke(None))
 def test_poke_no_messages(self, mock_hook):
     operator = PubSubPullSensor(task_id=TASK_ID, project=TEST_PROJECT,
                                 subscription=TEST_SUBSCRIPTION)
     mock_hook.return_value.pull.return_value = []
     self.assertEquals([], operator.poke(None))