1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-09 03:36:48 +00:00

docs(appsettings): each setting's description says what it does

The descriptions were tooltips, many only repeating the setting's name
("Cpu modes", "Debug for user quotas"). Now shown under each field, they
say what the setting changes: what a new VM or disk gets, how the
console starts, what a page shows. A migration writes them.
This commit is contained in:
catborise 2026-10-25 21:56:40 +03:00
parent 632f5e15bd
commit 07a2e09c2f
3 changed files with 68 additions and 1 deletions

View file

@ -99,7 +99,7 @@ class AppSettingsTestCase(TestCase):
(field,) = page.xpath("//*[@name='LOGS_PER_PAGE']")
self.assertEqual((field.get("type"), field.get("min"), field.get("max")), ("number", "1", "1000"))
self.assertEqual(page.xpath(f"//label[@for='{field.get('id')}']/text()"), ["Logs per Page"])
self.assertEqual(page.xpath(f"//*[@id='{field.get('aria-describedby')}']/text()"), ["Pagination for logs"])
self.assertEqual(page.xpath(f"//*[@id='{field.get('aria-describedby')}']/text()"), ["Rows per page on the Logs page"])
# a group is saved with its button, not on every change
self.assertEqual(page.xpath("//*[@onchange]"), [])

View file

@ -87,3 +87,15 @@ class ChoicesFixTestCase(TestCase):
"INSTANCE_MACHINE_DEFAULT_TYPE": ("q35", "q35,pc,virt"),
"INSTANCE_CDROM_ADD": ("sata", "None,ide,sata,scsi"),
})
descriptions = importlib.import_module("appsettings.migrations.0021_setting_descriptions")
class DescriptionsTestCase(TestCase):
def test_every_setting_says_what_it_does_within_its_column(self):
limit = AppSettings._meta.get_field("description").max_length
for key, text in descriptions.DESCRIPTIONS.items():
with self.subTest(key=key):
self.assertLessEqual(len(text), limit)
self.assertEqual(AppSettings.objects.get(key=key).description, text)