diff --git a/tests/test_health_check_form.py b/tests/test_health_check_form.py index 6c02897..388fc24 100644 --- a/tests/test_health_check_form.py +++ b/tests/test_health_check_form.py @@ -58,11 +58,49 @@ class HealthCheckFormTests(unittest.TestCase): self.assertIn("carriedSecurity", script) self.assertIn("Derived from availability", script) self.assertIn("Carried forward from the last saved check", script) - self.assertIn("placeholder", script) # The cloud key no longer renders the cloud results as form fields. self.assertNotIn('makeField("Cloud health check"', script) self.assertNotIn('makeField("Provider operational"', script) + def test_form_prefills_the_saved_values_as_input_values(self): + script = read_static("health-check.js") + # A previous value is a real input value, not an HTML placeholder, so an + # untouched field is saved as it stands (section 23.1). + self.assertIn("previousText", script) + self.assertIn("input.value = value", script) + self.assertNotIn("input.placeholder", script) + self.assertIn('previousText(previous, "firmware_version")', script) + self.assertIn('previousText(previous, "address_path")', script) + self.assertIn("updateSoftwareVersionValue", script) + self.assertIn("softwareVersionInput.value = reusable", script) + self.assertIn("previous.wallet_software === walletSoftwareSelect.value", script) + + def test_form_requires_an_explicit_compatibility_status(self): + html = read_static("health-check.html") + script = read_static("health-check.js") + self.assertIn('id="software-compatibility"', html) + self.assertIn('', html) + self.assertIn('name="software_compatibility_status" required', html) + self.assertNotIn('value="NOT_ASSESSED"', html) + # The hidden control carries the derived value for the cloud key and is + # not required for a key that was not available (sections 20 and 22). + self.assertIn("softwareCompatibilitySelect.required", script) + self.assertIn("compatibilityDerived", script) + self.assertIn('softwareCompatibilitySelect.value = "OK"', script) + + def test_form_asks_about_the_selected_key_holder_and_reminds_about_updates(self): + html = read_static("health-check.html") + script = read_static("health-check.js") + self.assertIn("this key holder's contact details are current?", html) + self.assertIn('