Those tests cover most of the package. It's especially important for
future refactoring if we add more authentication backends.
Details
Details
- Reviewers
dereckson - Commits
- rRPRTa0f60307e6f7: Test secretsmith
make test
Diff Detail
Diff Detail
- Repository
- rRPRT Nasqueron internal reports
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
tests/vault/client content written with Claude Sonnet 4 assistance.
Initial code artifact: https://claude.ai/public/artifacts/ab00d3f9-28ef-4f3d-8f5b-624cc1c4cf54
Prompt
Prompt was submitted with the following specifications, and in attachment tools/secretsmith/src/secretsmith/vault/client.py from a3a0169a347c.
Hi, I'm preparing test for a Python package "secretsmith". We want to test the client.from_config method, a wrapper to call hvac.client from a specific Vault configuration.
The tests:
- When using method: approle, we want to ensure client.auth.approle.login has been called
- When using method: notexisting, a ValueError is raised
We also want to test resolve_token:
- No config? returns None
- When using tokenfile to a file in tests/ folder, we've the token in it
- Config contains "token: s.0000", should return "s.0000"
Finally for resolve_namespace:
- from config: when using namespace: quux should return quux
- os.environ["VAULT_NAMESPACE"] = "quux", ensure it returns "quux"
- environment + config: ensure config value is used, not the environment value