def test_poke_fail_on_transient_error(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("434: Host unavailable") with self.assertRaises(error_perm) as context: op.execute(None) self.assertTrue("434" in str(context.exception))
def test_poke_fails_due_error(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("530: Login authentication failed") with self.assertRaises(error_perm) as context: op.execute(None) self.assertTrue("530" in str(context.exception))