This commit is contained in:
vee
2026-08-14 15:01:29 +08:00
parent 6d768aaef4
commit f77dda70fe
20 changed files with 1125 additions and 122 deletions
+12 -4
View File
@@ -122,16 +122,24 @@ class TestSelfCalibrationApi:
stopped = json.loads(response.read().decode("utf-8"))["state"]
assert not stopped["controller"]["armed"]
with urllib.request.urlopen(
self.request("/api/calibration/session/reset", method="POST", payload={}),
timeout=3,
) as response:
reset = json.loads(response.read().decode("utf-8"))["state"]
assert reset["transport"]["state"] == "disconnected"
assert [axis["permille"] for axis in reset["axes"]] == [0, 0, 0, 0]
def test_frontend_and_original_model_are_served_by_existing_service(self) -> None:
with urllib.request.urlopen(f"{self.base_url}/", timeout=3) as response:
html = response.read().decode("utf-8")
with urllib.request.urlopen(
f"{self.base_url}/self-calibration.js?v=calibration-6",
f"{self.base_url}/self-calibration.js?v=calibration-8",
timeout=3,
) as response:
script = response.read().decode("utf-8")
with urllib.request.urlopen(
f"{self.base_url}/self-calibration.css?v=calibration-10",
f"{self.base_url}/self-calibration.css?v=calibration-12",
timeout=3,
) as response:
styles = response.read().decode("utf-8")
@@ -160,8 +168,8 @@ class TestSelfCalibrationApi:
timeout=3,
)
assert 'href="/self-calibration.css?v=calibration-10"' in html
assert 'src="/self-calibration.js?v=calibration-6"' in html
assert 'href="/self-calibration.css?v=calibration-12"' in html
assert 'src="/self-calibration.js?v=calibration-8"' in html
assert 'data-calibration-page="live"' in script
assert 'data-calibration-view="live"' in script
assert 'data-calibration-page="hall"' not in script