Spaces:
Sleeping
Sleeping
Download backend/tests/test_branding.py from dauphinking/pump: direct link, hf CLI and curl.
- Browser
- Download file 1.18 kB
-
https://huggingface.co/spaces/dauphinking/pump/resolve/main/backend/tests/test_branding.py
- Command line
-
hf download hf://spaces/dauphinking/pump/backend/tests/test_branding.py
-
curl -L -o test_branding.py https://huggingface.co/spaces/dauphinking/pump/resolve/main/backend/tests/test_branding.py
1.18 kB
| from app.branding import BrandingStore, BrandingUpdate | |
| def test_branding_save_public_and_password_isolated(tmp_path, monkeypatch): | |
| monkeypatch.setenv("BIDITECH_BRANDING_CONFIG", str(tmp_path / "b.json")) | |
| monkeypatch.setenv("BIDITECH_BRANDING_SECRET", str(tmp_path / "bs.json")) | |
| store = BrandingStore() | |
| store.save(BrandingUpdate(plant_name="胶州水厂二期", system_title="泵组节能优化系统", | |
| company="上海碧帝", contact_phone="021-1", login_enabled=True, | |
| password="pump2026")) | |
| pub = store.public() | |
| assert pub["plant_name"] == "胶州水厂二期" | |
| assert pub["password_configured"] is True | |
| assert "password" not in pub # 公开信息不含口令 | |
| assert store.verify("pump2026") is True | |
| assert store.verify("wrong") is False | |
| def test_branding_no_password_allows_all(tmp_path, monkeypatch): | |
| monkeypatch.setenv("BIDITECH_BRANDING_CONFIG", str(tmp_path / "b.json")) | |
| monkeypatch.setenv("BIDITECH_BRANDING_SECRET", str(tmp_path / "bs.json")) | |
| store = BrandingStore() | |
| assert store.verify("anything") is True # 未设口令 → 放行 | |