first commit

This commit is contained in:
Leonid Pershin
2026-08-21 02:42:48 +03:00
commit 167d07a733
46 changed files with 3334 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
from gpu_rent.config import load_config
from gpu_rent.ssh_keys import ensure_ed25519, public_path
def test_load_config_missing_auth(monkeypatch, tmp_path):
monkeypatch.setenv("HOME", str(tmp_path))
monkeypatch.setenv("USERPROFILE", str(tmp_path))
for key in (
"OS_AUTH_URL",
"OS_USER_DOMAIN_NAME",
"OS_USERNAME",
"OS_PASSWORD",
"OS_PROJECT_ID",
"OS_REGION_NAME",
"GPU_RENT_AZ",
):
monkeypatch.delenv(key, raising=False)
cfg = load_config(require_auth=False)
assert not cfg.auth_ok
assert "OS_USERNAME" in cfg.missing
assert cfg.data_volume_size_gb == 100
def test_ssh_key_generate(tmp_path):
private = tmp_path / "id_ed25519"
got, pub = ensure_ed25519(private)
assert got == private
assert pub == public_path(private)
assert private.is_file()
assert pub.is_file()
text = pub.read_text(encoding="utf-8")
assert text.startswith("ssh-ed25519")
ensure_ed25519(private)
assert private.read_bytes()