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

@ -116,7 +116,7 @@ class OverviewTestCase(TestCase):
self.assertFalse(page.xpath("//div[@class='card-header'][normalize-space()='Hardware']"))
def test_the_list_links_the_overview_of_a_host_it_cannot_reach(self):
with patch.object(Compute, "status", new_callable=PropertyMock, return_value=False):
with patch.object(Compute, "connection", new_callable=PropertyMock, return_value=libvirtError("unreachable")):
page = html.fromstring(self.client.get(reverse("computes")).content)
# its name and its menu's Overview
self.assertEqual(len(page.xpath(f"//tbody//a[@href='{self.url}']")), 2)