diff --git a/src/gvm_sync_targets/cli/__init__.py b/src/gvm_sync_targets/cli/__init__.py index 478638c..45ed2dc 100644 --- a/src/gvm_sync_targets/cli/__init__.py +++ b/src/gvm_sync_targets/cli/__init__.py @@ -70,7 +70,7 @@ def gvm_sync_targets( # Ensure old target is unused old_target: Element = gmp.get_target(old_target_id)[0] - old_name = old_target.xpath("name/text()[1]") + old_name = cast(list[str], old_target.xpath("name/text()"))[0] if target_in_use(old_target): msg = "target is still in use" raise ValueError(msg) diff --git a/tests/gvm_sync_targets/cli_test.py b/tests/gvm_sync_targets/cli_test.py index fc15b3f..3629686 100644 --- a/tests/gvm_sync_targets/cli_test.py +++ b/tests/gvm_sync_targets/cli_test.py @@ -1,6 +1,7 @@ # SPDX-FileCopyrightText: 2024-present linuxdaemon # # SPDX-License-Identifier: MIT + from click.testing import CliRunner import gvm_sync_targets