refactor: fix lint warnings and remove stale type: ignore comments

This commit is contained in:
Johan Lundberg 2026-02-18 13:08:03 +01:00
parent 8c91edf137
commit 64f8c1936b
No known key found for this signature in database
GPG key ID: A6C152738D03C7D1
5 changed files with 34 additions and 28 deletions

View file

@ -39,7 +39,7 @@ def test_settings_from_env(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("OIDC_OP_ISSUER", "https://op.example.org")
monkeypatch.setenv("OIDC_OP_STORAGE_BACKEND", "mongodb")
monkeypatch.setenv("OIDC_OP_MONGODB_URI", "mongodb://remote:27017")
settings = Settings() # type: ignore[call-arg]
settings = Settings()
assert settings.issuer == "https://op.example.org"
assert settings.storage_backend == StorageBackend.MONGODB
@ -58,7 +58,7 @@ scope = ["openid", "profile"]
toml_file = tmp_path / "test.toml"
toml_file.write_text(toml_content)
settings = Settings(_toml_file=str(toml_file)) # type: ignore[call-arg]
settings = Settings(_toml_file=str(toml_file))
assert settings.issuer == "https://toml.example.com"
assert settings.debug is True
assert settings.sqlite_path == "custom/path.db"
@ -80,13 +80,13 @@ debug = false
monkeypatch.setenv("OIDC_OP_ISSUER", "https://env.example.com")
monkeypatch.setenv("OIDC_OP_DEBUG", "true")
settings = Settings(_toml_file=str(toml_file)) # type: ignore[call-arg]
settings = Settings(_toml_file=str(toml_file))
assert settings.issuer == "https://env.example.com"
assert settings.debug is True
def test_missing_toml_file_uses_defaults() -> None:
settings = Settings(issuer="http://localhost:8000", _toml_file="/nonexistent/path.toml") # type: ignore[call-arg]
settings = Settings(issuer="http://localhost:8000", _toml_file="/nonexistent/path.toml")
assert settings.issuer == "http://localhost:8000"
assert settings.clients == {}
@ -96,5 +96,5 @@ def test_config_file_env_var_override(tmp_path: Path, monkeypatch: pytest.Monkey
toml_file.write_text('issuer = "https://custom-path.example.com"\n')
monkeypatch.setenv("OIDC_OP_CONFIG_FILE", str(toml_file))
settings = Settings() # type: ignore[call-arg]
settings = Settings()
assert settings.issuer == "https://custom-path.example.com"