1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 12:46:49 +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:
catborise 2026-10-26 15:50:54 +03:00
parent 52d00e818b
commit b89f280076
6 changed files with 31 additions and 9 deletions

View file

@ -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)"))