from src.config.runtime_config import RuntimeConfig def test_runtime_config_reads_hf_project_state_writes_flag(monkeypatch) -> None: # noqa: ANN001 monkeypatch.setenv("BIRDNET_HF_PROJECT_STATE_WRITES_ENABLED", "true") config = RuntimeConfig.from_env() assert config.hf_project_state_writes_enabled is True def test_runtime_config_disables_hf_project_state_writes_by_default(monkeypatch) -> None: # noqa: ANN001 monkeypatch.delenv("BIRDNET_HF_PROJECT_STATE_WRITES_ENABLED", raising=False) config = RuntimeConfig.from_env() assert config.hf_project_state_writes_enabled is False def test_runtime_config_reads_hf_project_state_repo_list(monkeypatch) -> None: # noqa: ANN001 monkeypatch.setenv("BIRDNET_HF_PROJECT_STATE_REPOS", "owner/a_state; owner/b_state,\nowner/c_state") config = RuntimeConfig.from_env() assert config.hf_project_state_repos == ("owner/a_state", "owner/b_state", "owner/c_state") def test_runtime_config_reads_bucket_validation_flag(monkeypatch) -> None: # noqa: ANN001 monkeypatch.setenv("BIRDNET_HF_BUCKET_VALIDATIONS_ENABLED", "true") config = RuntimeConfig.from_env() assert config.hf_bucket_validations_enabled is True def test_runtime_config_reads_hf_admin_storage_mode_flag(monkeypatch) -> None: # noqa: ANN001 monkeypatch.setenv("BIRDNET_HF_ADMIN_STORAGE_MODE_ENABLED", "true") config = RuntimeConfig.from_env() assert config.hf_admin_storage_mode_enabled is True def test_runtime_config_disables_hf_admin_storage_mode_by_default(monkeypatch) -> None: # noqa: ANN001 monkeypatch.delenv("BIRDNET_HF_ADMIN_STORAGE_MODE_ENABLED", raising=False) monkeypatch.delenv("BIRDNET_HF_STORAGE_TOKEN", raising=False) config = RuntimeConfig.from_env() assert config.hf_admin_storage_mode_enabled is False def test_runtime_config_enables_hf_admin_storage_mode_when_dedicated_secret_exists(monkeypatch) -> None: # noqa: ANN001 monkeypatch.delenv("BIRDNET_HF_ADMIN_STORAGE_MODE_ENABLED", raising=False) monkeypatch.setenv("BIRDNET_HF_STORAGE_TOKEN", "hf_storage_secret") config = RuntimeConfig.from_env() assert config.hf_admin_storage_mode_enabled is True