Page MenuHomeDevCentral

Test secretsmith
ClosedPublic

Authored by dereckson on Sep 21 2025, 11:33.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 15, 06:13
Unknown Object (File)
Mon, Dec 15, 06:12
Unknown Object (File)
Mon, Dec 15, 06:11
Unknown Object (File)
Mon, Dec 15, 06:01
Unknown Object (File)
Wed, Dec 10, 02:13
Unknown Object (File)
Sun, Dec 7, 09:29
Unknown Object (File)
Fri, Nov 28, 19:22
Unknown Object (File)
Wed, Nov 26, 14:34
Subscribers
None
Tokens
"Y So Serious" token, awarded by dereckson.

Details

Summary

Those tests cover most of the package. It's especially important for
future refactoring if we add more authentication backends.

Test Plan

make test

Diff Detail

Repository
rRPRT Nasqueron internal reports
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dereckson created this revision.

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
This revision is now accepted and ready to land.Sep 21 2025, 11:42
This revision was automatically updated to reflect the committed changes.