Fix candidate build metadata and runtime safeguards
Offline project checks / check (push) Canceled after 0s
Offline project checks / check (push) Canceled after 0s
Repair kernel patch formatting and refresh kernel/camera package revisions and checksums. Integrate battery guard into generated images, correct charging controls and emergency shutdown handling, and reject invalid camera authentication configuration. Extend recipe validation and regression coverage, and update build and installation documentation. Kernel, camera and image compilation remain pending on the build server.
This commit is contained in:
@@ -27,6 +27,39 @@ serve = module('serve')
|
||||
mqtt = module('camera_mqtt')
|
||||
|
||||
|
||||
class AuthenticationConfigTests(unittest.TestCase):
|
||||
def test_optional_and_explicitly_disabled_authentication(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
path = Path(temp) / 'auth.json'
|
||||
self.assertIsNone(serve.load_auth(path))
|
||||
path.write_text(json.dumps({'enabled': False}))
|
||||
self.assertIsNone(serve.load_auth(path))
|
||||
path.write_text(json.dumps({'username': 'operator', 'password': 'test-password'}))
|
||||
self.assertEqual(serve.load_auth(path), {'username': 'operator', 'password': 'test-password'})
|
||||
|
||||
def test_invalid_authentication_never_falls_back_to_anonymous(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
path = Path(temp) / 'auth.json'
|
||||
for content in ('{broken', '[]', '{}', '{"enabled": "false"}',
|
||||
'{"username": "operator"}', '{"username": "", "password": "value"}',
|
||||
'{"username": 123, "password": "value"}'):
|
||||
with self.subTest(content=content):
|
||||
path.write_text(content)
|
||||
with self.assertRaises(ValueError):
|
||||
serve.load_auth(path)
|
||||
path.unlink()
|
||||
path.symlink_to('missing-credentials')
|
||||
with self.assertRaises(ValueError):
|
||||
serve.load_auth(path)
|
||||
|
||||
def test_unreadable_authentication_aborts_without_exposing_credentials(self):
|
||||
path = Mock()
|
||||
path.read_text.side_effect = PermissionError('sensitive contents')
|
||||
with self.assertRaisesRegex(ValueError, 'cannot be read') as error:
|
||||
serve.load_auth(path)
|
||||
self.assertNotIn('sensitive', str(error.exception))
|
||||
|
||||
|
||||
class ControlTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.tmp = tempfile.TemporaryDirectory()
|
||||
|
||||
Reference in New Issue
Block a user