def test_execute(self, mock_hook): operator = DingdingOperator(task_id='dingding_task', dag=self.dag, **self._config) self.assertIsNotNone(operator) self.assertEqual(self._config['dingding_conn_id'], operator.dingding_conn_id) self.assertEqual(self._config['message_type'], operator.message_type) self.assertEqual(self._config['message'], operator.message) self.assertEqual(self._config['at_mobiles'], operator.at_mobiles) self.assertEqual(self._config['at_all'], operator.at_all) operator.execute(None) mock_hook.assert_called_once_with( self._config['dingding_conn_id'], self._config['message_type'], self._config['message'], self._config['at_mobiles'], self._config['at_all'], ) mock_hook.return_value.send.assert_called_once_with()
def test_execute(self, mock_hook): operator = DingdingOperator(task_id='dingding_task', dag=self.dag, **self._config) assert operator is not None assert self._config['dingding_conn_id'] == operator.dingding_conn_id assert self._config['message_type'] == operator.message_type assert self._config['message'] == operator.message assert self._config['at_mobiles'] == operator.at_mobiles assert self._config['at_all'] == operator.at_all operator.execute(None) mock_hook.assert_called_once_with( self._config['dingding_conn_id'], self._config['message_type'], self._config['message'], self._config['at_mobiles'], self._config['at_all'], ) mock_hook.return_value.send.assert_called_once_with()