credtest

package
v1.0.49 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package credtest provides a hermetic credential environment for tests (§1.12 test obligation). It forces credstore's encrypted-file backend inside a per-test temp HOME with a fixed passphrase, so no test ever touches the real OS keyring, shells out to `security`/`secret-tool`, or depends on machine state.

It is deliberately a tiny leaf (only testing + migrationsink) so that the white-box `package keychain` tests can import it without the keychain<->testutil import cycle that the fixture-heavy internal/testutil would introduce.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup(t *testing.T) string

Setup isolates HOME/XDG to a temp dir and forces credstore's file backend with a known passphrase via the §1.4 named env vars. The darwin `security` and Linux `secret-tool` legacy probes are neutralized so the suite is hermetic regardless of the destination backend (§2.3). Returns the temp dir so a test can plant legacy artifacts (token.json, credentials.json, config.json, a keychain item) under it.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL