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:
Mathieu Moran
2026-08-10 17:37:52 -04:00
co-authored by Copilot
parent 585da18225
commit 5a5058adca
4 changed files with 30 additions and 5 deletions
+8
View File
@@ -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()