mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 11:16:47 +00:00
Redirects to #access (root password, SSH key) and other top-level panes opened nothing, and some sub-tab ids did not exist. static/js/instance_tabs.js opens the pane and the tab that holds it from the page structure, and opens Settings on its first section, without leaving the current tab; guest OS info is loaded whenever it is the section opened. The bottom bar linked to host pages, which only administrators may open, and showed host names to everyone. A stray </li> is removed; the page's inline scripts and the tab logic are checked with Node.
23 lines
725 B
Python
23 lines
725 B
Python
"""The VM page opens the tab a redirect points to (static/js/instance_tabs.js).
|
|
Its behaviour is checked with Node."""
|
|
|
|
import shutil
|
|
import subprocess
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
from django.conf import settings
|
|
|
|
BASE = Path(settings.BASE_DIR)
|
|
|
|
|
|
class InstanceTabsTestCase(unittest.TestCase):
|
|
@unittest.skipUnless(shutil.which("node"), "node is not installed")
|
|
def test_instance_tabs_js(self):
|
|
result = subprocess.run(
|
|
["node", str(BASE / "webvirtcloud/js_tests/instance_tabs.test.js"), str(BASE / "static/js/instance_tabs.js")],
|
|
capture_output=True,
|
|
text=True,
|
|
timeout=60,
|
|
)
|
|
self.assertEqual(result.returncode, 0, result.stderr)
|