mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
fix(instances): VM list columns, hosts for viewers, flavor units
- On a narrow screen the grouped list hid the User, VCPU and Memory headings but not the VMs' cells, so values sat under the wrong headings; the cells now hide with their headings. Memory says MiB. - A user with the view_instances permission sees each VM's host in the list, as the host alerts already name them; the host page link stays a superuser's. - A flavor's memory and disk are labelled MiB and GiB, and each value is at least 1, so "4" is no longer saved as a 4 MiB preset by mistake.
This commit is contained in:
parent
7029f9b212
commit
a3de55d5ee
6 changed files with 31 additions and 9 deletions
|
|
@ -307,3 +307,12 @@ class XmlRefusalTests(TestCase):
|
|||
|
||||
def test_a_definition_libvirt_refuses(self):
|
||||
self.assertIn("libvirt", self.post("<domain type='nope'><name>new</name><memory>1024</memory></domain>"))
|
||||
|
||||
|
||||
class FlavorFormTests(TestCase):
|
||||
def test_a_flavor_is_at_least_one_of_each_in_named_units(self):
|
||||
from instances.forms import FlavorForm
|
||||
|
||||
form = FlavorForm({"label": "tiny", "memory": "0", "vcpu": "-1", "disk": "0"})
|
||||
self.assertEqual(set(form.errors), {"memory", "vcpu", "disk"})
|
||||
self.assertEqual((form["memory"].label, form["disk"].label), ("Memory (MiB)", "Disk (GiB)"))
|
||||
|
|
|
|||
|
|
@ -61,3 +61,10 @@ class IndexHostAlertTests(TestCase):
|
|||
viewer.user_permissions.add(Permission.objects.get(codename="view_instances"))
|
||||
response = self.get(viewer, down={"other-host"})
|
||||
self.assertContains(response, "Connection Failed: no route to 10.0.0.2")
|
||||
|
||||
def test_global_viewer_sees_each_vms_host_without_the_host_page(self):
|
||||
viewer = get_user_model().objects.create_user(username="viewer2", password="pwd")
|
||||
viewer.user_permissions.add(Permission.objects.get(codename="view_instances"))
|
||||
response = self.get(viewer, down=set())
|
||||
self.assertContains(response, "mine-host")
|
||||
self.assertNotContains(response, reverse("overview", args=[self.mine.id]))
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class ListInfoCallTests(TestCase):
|
|||
self.assertEqual(response.status_code, 200)
|
||||
return response
|
||||
|
||||
def assert_one_info_per_vm(self, response, memory="2048 MB"):
|
||||
def assert_one_info_per_vm(self, response, memory="2048 MiB"):
|
||||
self.assertEqual(len(self.domains), 2, "one proxy per VM row")
|
||||
for domain in self.domains:
|
||||
self.assertEqual(domain.info_calls, 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue