def test_build_opsgenie_payload(self): # Given / When operator = OpsgenieAlertOperator(task_id='opsgenie_alert_job', dag=self.dag, **self._config) payload = operator._build_opsgenie_payload() # Then self.assertEqual(self.expected_payload_dict, payload)
def test_properties(self): # Given / When operator = OpsgenieAlertOperator(task_id='opsgenie_alert_job', dag=self.dag, **self._config) self.assertEqual('opsgenie_default', operator.opsgenie_conn_id) self.assertEqual(self._config['message'], operator.message) self.assertEqual(self._config['alias'], operator.alias) self.assertEqual(self._config['description'], operator.description) self.assertEqual(self._config['responders'], operator.responders) self.assertEqual(self._config['visible_to'], operator.visible_to) self.assertEqual(self._config['actions'], operator.actions) self.assertEqual(self._config['tags'], operator.tags) self.assertEqual(self._config['details'], operator.details) self.assertEqual(self._config['entity'], operator.entity) self.assertEqual(self._config['source'], operator.source) self.assertEqual(self._config['priority'], operator.priority) self.assertEqual(self._config['user'], operator.user) self.assertEqual(self._config['note'], operator.note)
def test_properties(self): # Given / When operator = OpsgenieAlertOperator(task_id='opsgenie_alert_job', dag=self.dag, **self._config) assert 'opsgenie_default' == operator.opsgenie_conn_id assert self._config['message'] == operator.message assert self._config['alias'] == operator.alias assert self._config['description'] == operator.description assert self._config['responders'] == operator.responders assert self._config['visible_to'] == operator.visible_to assert self._config['actions'] == operator.actions assert self._config['tags'] == operator.tags assert self._config['details'] == operator.details assert self._config['entity'] == operator.entity assert self._config['source'] == operator.source assert self._config['priority'] == operator.priority assert self._config['user'] == operator.user assert self._config['note'] == operator.note
# distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. from datetime import datetime from airflow import DAG from airflow.providers.opsgenie.operators.opsgenie_alert import OpsgenieAlertOperator with DAG( dag_id="opsgenie_alert_operator_dag", schedule_interval=None, start_date=datetime(2021, 1, 1), catchup=False, ) as dag: # [START howto_opsgenie_alert_operator] opsgenie_alert_operator = OpsgenieAlertOperator(task_id="opsgenie_task", message="Hello World!") # [END howto_opsgenie_alert_operator]