mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 11:16:47 +00:00
SPICE was removed earlier; its leftovers and the console type choice go too: - the console settings form, update_console and the backend no longer offer or change the type; an invalid console form now shows its errors instead of being ignored; - the create form, the API serializer and create_instance no longer take a graphics type, new VMs get VNC; get_graphics_types and the graphics entries of the domain capabilities are gone; - migration appsettings.0013 deletes QEMU_CONSOLE_DEFAULT_TYPE; - a VM defined elsewhere with another graphics type gets "Console type ... is not supported". The locale catalogs still reference the deleted SPICE templates in source comments; regenerating them is left to the translation work.
27 lines
1.2 KiB
Python
27 lines
1.2 KiB
Python
from unittest.mock import patch
|
|
|
|
from computes.models import Compute
|
|
from django.contrib.auth import get_user_model
|
|
from django.test import TestCase
|
|
from django.urls import reverse
|
|
from instances.models import Instance
|
|
|
|
|
|
class UpdateConsoleTestCase(TestCase):
|
|
def setUp(self):
|
|
admin = get_user_model().objects.create_superuser("console_admin", "c@example.com", "pw")
|
|
self.client.force_login(admin)
|
|
compute = Compute.objects.create(name="console-compute", hostname="127.0.0.1", login="", password="", type=4)
|
|
self.instance = Instance.objects.create(
|
|
compute=compute, name="console-vm", uuid="11111111-2222-3333-4444-555555555555"
|
|
)
|
|
|
|
def post(self, data):
|
|
with patch("instances.models.wvmInstance") as wvm:
|
|
self.client.post(reverse("instances:update_console", args=[self.instance.id]), data)
|
|
return wvm.return_value
|
|
|
|
def test_console_settings_are_applied(self):
|
|
proxy = self.post({"listen_on": "127.0.0.1", "password": "", "keymap": "de"})
|
|
proxy.set_console_keymap.assert_called_once_with("de")
|
|
proxy.set_console_listener_addr.assert_called_once_with("127.0.0.1")
|