mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 16:23:46 +08:00
leedle
This commit is contained in:
@@ -30,3 +30,27 @@ def test_hidden_testing_ground_selection_is_migrated(tmp_path, monkeypatch, hidd
|
||||
payload = json.loads(state_path.read_text(encoding="utf-8"))
|
||||
assert payload["activeSlot"] == tg.TESTING_GROUND_1
|
||||
assert payload["activeVariant"] == tg.DEFAULT_TESTING_GROUND_VARIANT
|
||||
|
||||
|
||||
def test_hidden_slot_invalid_variant_is_migrated_off_slot(tmp_path, monkeypatch):
|
||||
state_path = tmp_path / "slots.json"
|
||||
state_path.write_text(json.dumps({
|
||||
"schemaVersion": tg.TESTING_GROUNDS_SCHEMA_VERSION,
|
||||
"activeSlot": tg.TESTING_GROUND_5,
|
||||
"activeVariant": "C",
|
||||
}), encoding="utf-8")
|
||||
|
||||
monkeypatch.setattr(tg, "TESTING_GROUNDS_STATE_PATH", state_path)
|
||||
monkeypatch.setattr(tg, "_CACHE_LAST_REFRESH", 0.0)
|
||||
monkeypatch.setattr(tg, "_CACHE_LAST_MTIME_NS", -1)
|
||||
monkeypatch.setattr(tg, "_CACHE_ACTIVE_SLOT", tg._DEFAULT_ACTIVE_SLOT)
|
||||
monkeypatch.setattr(tg, "_CACHE_ACTIVE_VARIANT", tg.DEFAULT_TESTING_GROUND_VARIANT)
|
||||
|
||||
active_slot, active_variant = tg.get_testing_ground_selection(refresh_interval_s=0.0)
|
||||
|
||||
assert active_slot == tg.TESTING_GROUND_1
|
||||
assert active_variant == tg.DEFAULT_TESTING_GROUND_VARIANT
|
||||
|
||||
payload = json.loads(state_path.read_text(encoding="utf-8"))
|
||||
assert payload["activeSlot"] == tg.TESTING_GROUND_1
|
||||
assert payload["activeVariant"] == tg.DEFAULT_TESTING_GROUND_VARIANT
|
||||
|
||||
Reference in New Issue
Block a user