修复运行时凭证与网络出口兼容性
This commit is contained in:
13
test_main.py
13
test_main.py
@@ -42,6 +42,19 @@ class AutoAdaptationTests(unittest.TestCase):
|
||||
token = resolve_runtime_token({"EXTERNAL_SERVICE_TOKEN": "private-value"})
|
||||
self.assertEqual(token, "private-value")
|
||||
|
||||
def test_runtime_token_file_is_supported(self):
|
||||
token = resolve_runtime_token(
|
||||
{"XC_TOKEN_FILE": "/run/secrets/xc-token"},
|
||||
read_text=lambda path: "mounted-private-value\n"
|
||||
if path == "/run/secrets/xc-token"
|
||||
else "",
|
||||
)
|
||||
self.assertEqual(token, "mounted-private-value")
|
||||
|
||||
def test_placeholder_runtime_token_is_rejected(self):
|
||||
token = resolve_runtime_token({"EXTERNAL_SERVICE_TOKEN": "tmp"})
|
||||
self.assertEqual(token, "")
|
||||
|
||||
def test_explicit_modelhub_token_takes_precedence(self):
|
||||
token = resolve_runtime_token(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user