fix: reuse upload credentials for device config sync
- load server sync creds from db/upload_creds.env like uploads do - fall back from YARIS_DEVICE_KEY to existing YARIS_API_KEY - document shared credential flow for server-synced identity - add test coverage for sync credential fallback Co-authored-by: Copilot <[email protected]>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import unittest
|
||||
import os
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from modules import app_account, app_car, app_device_sync
|
||||
@@ -55,6 +56,13 @@ class DeviceSyncReloadCallbackTest(unittest.TestCase):
|
||||
finally:
|
||||
app_device_sync._RELOAD_CALLBACK = original
|
||||
|
||||
@patch.dict(os.environ, {"YARIS_SERVER_URL": "https://example.test", "YARIS_API_KEY": "upload-key"}, clear=True)
|
||||
def test_sync_credentials_fall_back_to_upload_api_key(self):
|
||||
server_url, device_key = app_device_sync._server_credentials()
|
||||
|
||||
self.assertEqual(server_url, "https://example.test")
|
||||
self.assertEqual(device_key, "upload-key")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user