Skip to content

Commit

Permalink
fix: dedup ips before checking length
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxdaemon committed May 13, 2024
1 parent e0ea838 commit 6190d36
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ repos:
rev: 7c0bc1591103b1f089aab9810fc2a201ccb0552b
- hooks:
- entry: hatch run python3 -m mypy
exclude: tests/.*
id: mypy
language: system
name: mypy
Expand Down
4 changes: 2 additions & 2 deletions src/gvm_sync_targets/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ def gvm_sync_targets(
to_remove: list[str] = []

for host in existing_hosts.assets:
ips = [
ips = {
identifier.value
for identifier in host.identifiers.identifiers
if identifier.name == "ip"
]
}

if len(ips) > 1:
raise ValueError(f"Multiple IPs?: {ips}")
Expand Down
4 changes: 2 additions & 2 deletions tests/gvm_sync_targets/models/auth_response_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MIT

from gvm_sync_targets.models import AuthenticateResponse
from gvm_sync_targets.models.auth_response import AuthenticateResponse

data = """
<authenticate_response status="200" status_text="OK">
Expand All @@ -12,7 +12,7 @@
"""


def test_auth_response():
def test_auth_response() -> None:
model = AuthenticateResponse.from_xml(data)
assert model.role == "Admin"
assert model.timezone == "UTC"

0 comments on commit 6190d36

Please sign in to comment.