def test_poke_ignore_transient_error(self, mock_hook): op = FTPSensor(path="foobar.json", ftp_conn_id="bob_ftp", task_id="test_task", fail_on_transient_errors=False) mock_hook.return_value.__enter__.return_value.get_mod_time.side_effect = [ error_perm("434: Host unavailable"), None ] self.assertFalse(op.poke(None)) self.assertTrue(op.poke(None))
def test_poke(self, mock_hook): op = FTPSensor(path="foobar.json", ftp_conn_id="bob_ftp", task_id="test_task") mock_hook.return_value.__enter__.return_value.get_mod_time.side_effect = [ error_perm("550: Can't check for file existence"), error_perm("550: Directory or file does not exist"), error_perm("550 - Directory or file does not exist"), None ] self.assertFalse(op.poke(None)) self.assertFalse(op.poke(None)) self.assertFalse(op.poke(None)) self.assertTrue(op.poke(None))