Fixed up ping test

This commit is contained in:
Jonas Linter
2025-10-02 15:44:52 +02:00
parent 48aec92794
commit 325965bb10
2 changed files with 13 additions and 7 deletions

2
.gitignore vendored
View File

@@ -17,6 +17,8 @@ wheels/
# ignore test_data content but keep the folder
test_data/*
test/test_output/*
# ignore secrets
secrets.yaml

View File

@@ -1,4 +1,5 @@
import json
import pytest
import asyncio
from alpine_bits_python.alpinebits_server import AlpineBitsServer, AlpineBitsClientInfo
@@ -34,14 +35,17 @@ async def test_ping_action_response_matches_expected():
)
actual_obj = extract_relevant_sections(response.xml_content)
expected_obj = extract_relevant_sections(expected_xml)
# log failures to xml files in test_output for easier debugging
if actual_obj != expected_obj:
with open("test/test_output/actual_ping_response.xml", "w", encoding="utf-8") as f:
f.write(response.xml_content)
with open("test/test_output/expected_ping_response.xml", "w", encoding="utf-8") as f:
f.write(expected_xml)
assert actual_obj == expected_obj
actual_matches = actual_obj.warnings.warning
expected_matches = expected_obj.warnings.warning
assert actual_matches == expected_matches, f"Expected warnings {expected_matches}, got {actual_matches}"
actual_capabilities = actual_obj.echo_data
expected_capabilities = expected_obj.echo_data
assert actual_capabilities == expected_capabilities, f"Expected echo data {expected_capabilities}, got {actual_capabilities}"
@pytest.mark.asyncio
async def test_ping_action_response_success():