1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-01 16:36:06 +00:00

test: no test connects to a real host

Tests of eight files patched a host's status but not what the page also read, its
connection, connection_error or proxy, and so connected for real: over
ssh to 10.0.0.9 or over TCP to unroutable addresses (5 to 10 s each until
the connect timeout), and to the machine's own libvirt (qemu:///system).
A failed host is not tried again for a while, so only the first such test
of a process connected, and which one depended on the order. They now
patch the connection itself, or what the page reads, and use RFC 5737
addresses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
catborise 2026-11-08 22:20:25 +03:00
parent 0d225edda4
commit 9f323d709e
8 changed files with 41 additions and 22 deletions

View file

@ -135,7 +135,8 @@ class CreateDialogHostsTestCase(TestCase):
self.addCleanup(p.stop)
def dialog(self, reachable):
with patch.object(Compute, "status", property(lambda compute: compute.name in reachable)):
with patch.object(Compute, "status", property(lambda compute: compute.name in reachable)), \
patch.object(Compute, "connection_error", property(lambda c: None if c.name in reachable else "unreachable")):
response = self.client.get(reverse("instances:index"))
return html.fromstring(response.content).get_element_by_id("AddInstance")