def test_poke(self, mock_hook): sensor = CassandraTableSensor( task_id='test_task', cassandra_conn_id='cassandra_default', table='t', ) sensor.poke(None) mock_hook.return_value.table_exists.assert_called_once_with('t')
class TestCassandraTableSensor(unittest.TestCase): def setUp(self): args = {'owner': 'airflow', 'start_date': DEFAULT_DATE} self.dag = DAG('test_dag_id', default_args=args) self.sensor = CassandraTableSensor( task_id='test_task', cassandra_conn_id='cassandra_default', dag=self.dag, table='t', ) @patch("airflow.contrib.hooks.cassandra_hook.CassandraHook.table_exists") def test_poke(self, mock_table_exists): self.sensor.poke(None) mock_table_exists.assert_called_once_with('t')
class TestCassandraTableSensor(unittest.TestCase): def setUp(self): configuration.load_test_config() args = { 'owner': 'airflow', 'start_date': DEFAULT_DATE } self.dag = DAG('test_dag_id', default_args=args) self.sensor = CassandraTableSensor( task_id='test_task', cassandra_conn_id='cassandra_default', dag=self.dag, table='t', ) @patch("airflow.contrib.hooks.cassandra_hook.CassandraHook.table_exists") def test_poke(self, mock_table_exists): self.sensor.poke(None) mock_table_exists.assert_called_once_with('t')