Beispiel #1
0
 def test_poke(self, mock_hook):
     mock_instance = mock_hook.return_value
     sensor = WasbPrefixSensor(
         task_id='wasb_sensor', dag=self.dag, check_options={'timeout': 2}, **self._config
     )
     sensor.poke(None)
     mock_instance.check_for_prefix.assert_called_once_with('container', 'prefix', timeout=2)
Beispiel #2
0
    def test_init(self):
        sensor = WasbPrefixSensor(task_id='wasb_sensor_1', dag=self.dag, **self._config)
        self.assertEqual(sensor.container_name, self._config['container_name'])
        self.assertEqual(sensor.prefix, self._config['prefix'])
        self.assertEqual(sensor.wasb_conn_id, self._config['wasb_conn_id'])
        self.assertEqual(sensor.check_options, {})
        self.assertEqual(sensor.timeout, self._config['timeout'])

        sensor = WasbPrefixSensor(
            task_id='wasb_sensor_2', dag=self.dag, check_options={'timeout': 2}, **self._config
        )
        self.assertEqual(sensor.check_options, {'timeout': 2})
Beispiel #3
0
    def test_init(self):
        sensor = WasbPrefixSensor(task_id='wasb_sensor_1',
                                  dag=self.dag,
                                  **self._config)
        assert sensor.container_name == self._config['container_name']
        assert sensor.prefix == self._config['prefix']
        assert sensor.wasb_conn_id == self._config['wasb_conn_id']
        assert sensor.check_options == {}
        assert sensor.timeout == self._config['timeout']

        sensor = WasbPrefixSensor(task_id='wasb_sensor_2',
                                  dag=self.dag,
                                  check_options={'timeout': 2},
                                  **self._config)
        assert sensor.check_options == {'timeout': 2}