testguard

package
v1.261119.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testguard keeps a test binary away from the App Store Connect credentials of the developer who runs it.

A developer who has signed in with asc has a real API key, Apple Ads key and web session on the machine: in ~/.asc, in a repo-local .asc above the checkout, in the keychain, and in ASC_* variables of their shell. A test that did not isolate one of these ran with that account, and a command test that expected to stop at "no authentication" sent real requests to Apple instead. In a test binary this package hides all of them, so every test sees the machine as CI does. It does nothing in any other binary, nor in the opt-in integration build, whose tests use the developer's credentials on purpose.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HideForTest

func HideForTest(dirs ...string) (restore func())

HideForTest also hides dirs, as if they belonged to the developer, until restore is called.

func Hides

func Hides(path string) bool

Hides reports whether path is inside a .asc directory of the developer running the tests. It is always false outside a test binary.

func OpenKeyring

func OpenKeyring(cfg keyring.Config) (keyring.Keyring, error)

OpenKeyring opens the system keyring. A test binary gets keyring.ErrNoAvailImpl, as on a machine without one; tests of keychain behaviour install a fake keyring instead.

Types

This section is empty.

Jump to

Keyboard shortcuts

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