from repo_manager.registrar import is_identifier_registrar def test_env_true_wins_over_hostname(monkeypatch): monkeypatch.setenv("STATEHUB_REGISTRAR", "1") assert is_identifier_registrar(hostname="bnt-lap001") is True def test_env_false_wins_over_production_hostname(monkeypatch): monkeypatch.setenv("STATEHUB_REGISTRAR", "0") assert is_identifier_registrar(hostname="railiance") is False def test_hostname_prefix_when_env_unset(monkeypatch): monkeypatch.delenv("STATEHUB_REGISTRAR", raising=False) assert is_identifier_registrar(hostname="railiance") is True assert is_identifier_registrar(hostname="railiance-prod") is True assert is_identifier_registrar(hostname="bnt-lap001") is False def test_env_aliases(monkeypatch): monkeypatch.setenv("STATEHUB_REGISTRAR", "yes") assert is_identifier_registrar(hostname="other") is True monkeypatch.setenv("STATEHUB_REGISTRAR", "off") assert is_identifier_registrar(hostname="railiance") is False