Page MenuHomeDevCentral

Test secretsmith
ClosedPublic

Authored by dereckson on Sep 21 2025, 11:33.
Tags
None
Referenced Files
F12385763: D3706.id9591.diff
Sat, Nov 1, 02:15
Unknown Object (File)
Wed, Oct 29, 15:00
Unknown Object (File)
Tue, Oct 28, 10:21
Unknown Object (File)
Sun, Oct 26, 19:37
Unknown Object (File)
Thu, Oct 23, 07:47
Unknown Object (File)
Mon, Oct 20, 16:17
Unknown Object (File)
Mon, Oct 20, 16:17
Unknown Object (File)
Mon, Oct 20, 14:26
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.