Categorygithub.com/jasonhancock/go-testhelpers/generic
modulepackage
0.0.15
Repository: https://github.com/jasonhancock/go-testhelpers.git
Documentation: pkg.go.dev

# Functions

CopyFile copies src to dest atomically by creating an intermediate temporary file and then doing an atomic rename.
FilesEqual compares the contents of two files to see if they're equal.
GenerateSelfSignedCert generates a self-signed RSA certificate for testing purposes.
No description provided by the author
JSONResponse sets up a basic http.Response with an object in the body of the response.
LoadCertificateAuthority loads a CA from two io.Readers.
LoadCertificateAuthorityFiles loads a CA from a cert and key on disk.
MustCommand executes the command and requires a clean exit code.
NewCertificateAuthority initializes a CertificateAuthority.
NewRandomPort identifies a port on the localhost interface for use during tests and returns the string in interface:port format.
NewTestClient returns *http.Client with Transport replaced to avoid making real calls.
No description provided by the author
No description provided by the author
RequireJSONValue takes a JSON string as input, then checks that the key matches the value.
No description provided by the author
No description provided by the author
No description provided by the author
SetEnvs sets environment variables, preserving any existing values from the envioronment, and restoring when the test is finished.
Walk traverses a directory tree and returns the list of files discovered.

# Structs

CertificateAuthority is a test CA that is capable of signing certs for use during testing.

# Type aliases

RoundTripFunc is a function that will be called to fulfill and http request.