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

perf(nwfilters): a filter's page takes the filter names from the listing it already reads

The page listed the host's filters twice: once for their names and once for the filters with their references. The names now come from the second listing.

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 12:04:35 +03:00
parent 7b5ccff8f5
commit 490b7efe3f
2 changed files with 9 additions and 4 deletions

View file

@ -177,7 +177,11 @@ class PageTests(TestCase):
self.assertEqual(page.xpath("//button[@name='del_nwfilter']"), [])
def test_a_reference_to_a_filter_gone_is_not_a_link(self):
self.wvm.listNWFilters.return_value = ["web"]
page = html.fromstring(self.client.get(reverse("nwfilter", args=[self.compute.id, "web"])).content)
url = reverse("nwfilter", args=[self.compute.id, "web"])
page = html.fromstring(self.client.get(url).content) # the host lists only "web"
self.assertEqual(page.xpath("//a[text()='clean-traffic']"), [])
self.assertIn("Missing", page.xpath("//td[contains(., 'clean-traffic')]")[0].text_content())
clean = MagicMock(**{"name.return_value": "clean-traffic", "XMLDesc.return_value": "<filter name='clean-traffic'/>"})
self.wvm.listAllNWFilters.return_value.append(clean)
page = html.fromstring(self.client.get(url).content)
self.assertEqual(page.xpath("//a[text()='clean-traffic']/@href"), [reverse("nwfilter", args=[self.compute.id, "clean-traffic"])])