17 lines
965 B
Python
17 lines
965 B
Python
from spriteforge.studio.config import GpuProfile,get_profile,load_config,save_profile
|
|
|
|
|
|
def test_gpu_profiles_do_not_store_secrets(tmp_path):
|
|
path=tmp_path/"providers.json"
|
|
save_profile(GpuProfile(name="renderbox",endpoint="https://gpu.invalid",workflow="workflow.json",token_env="SF_GPU_TOKEN"),path)
|
|
profile=get_profile("renderbox",path)
|
|
assert profile.endpoint=="https://gpu.invalid" and profile.token_env=="SF_GPU_TOKEN"
|
|
assert "secret" not in path.read_text().lower()
|
|
save_profile(GpuProfile(name="renderbox",endpoint="http://new",workflow="new.json"),path)
|
|
assert len(load_config(path).profiles)==1 and get_profile("renderbox",path).endpoint=="http://new"
|
|
|
|
|
|
def test_relay_profile_roundtrip(tmp_path):
|
|
path=tmp_path/"providers.json";save_profile(GpuProfile(name="pull",kind="relay",endpoint="https://relay.invalid",workflow="flow.json",token_env="SF_RELAY_CLIENT_TOKEN"),path)
|
|
assert get_profile("pull",path).kind=="relay"
|