Documentation ¶
Overview ¶
Package testhelpers contains various testing helper functions.
Index ¶
- func MustExtractECPublicKey(t *testing.T, keyPEM string) *ecdsa.PublicKey
- func MustExtractRSAPublicKey(t *testing.T, keyPEM string) *rsa.PublicKey
- func MustGetCSRFromFile(t *testing.T, filename string) *x509.CertificateRequest
- func MustGetCertFromFile(t *testing.T, filename string) *x509.Certificate
- func MustGetConfigFromEnv(v string) string
- func MustGetPrivateKeyFromFile(t *testing.T, filename string) interface{}
- func MustGetPrivateKeyFromFileWithPassword(t *testing.T, filename, password string) interface{}
- func MustGetPublicKeyFromFile(t *testing.T, filename string) interface{}
- func MustMakeRandomIdentifier(t *testing.T, n int) string
- func MustParseCSR(t *testing.T, reqPEM string) *x509.CertificateRequest
- func MustParseCert(t *testing.T, certPEM string) *x509.Certificate
- func MustParseECPrivateKey(t *testing.T, keyPEM string) *ecdsa.PrivateKey
- func MustParseRSAPrivateKey(t *testing.T, keyPEM string) *rsa.PrivateKey
- func MustParseURI(t *testing.T, s string) *url.URL
- func MustReadFile(t *testing.T, filename string) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustExtractECPublicKey ¶
MustExtractECPublicKey successfully parses a PEM-encoded EC private key and extracts the public key from it or fails the test.
func MustExtractRSAPublicKey ¶
MustExtractRSAPublicKey successfully parses a PEM-encoded RSA private key and extracts the public key from it or fails the test.
func MustGetCSRFromFile ¶
func MustGetCSRFromFile(t *testing.T, filename string) *x509.CertificateRequest
MustGetCSRFromFile successfully retrieves a CSR from a PEM-encoded file or fails the test.
func MustGetCertFromFile ¶
func MustGetCertFromFile(t *testing.T, filename string) *x509.Certificate
MustGetCertFromFile successfully retrieves a certificate from a PEM-encoded file or fails the test.
func MustGetConfigFromEnv ¶
MustGetConfigFromEnv retrieves a value from the named environment variable, or exits if the environment variable is not set.
func MustGetPrivateKeyFromFile ¶
MustGetPrivateKeyFromFile successfully retrieves a private key from a PEM-encoded file or fails the test.
func MustGetPrivateKeyFromFileWithPassword ¶
MustGetPrivateKeyFromFileWithPassword successfully retrieves an encrypted private key from a PEM-encoded file or fails the test.
func MustGetPublicKeyFromFile ¶
MustGetPublicKeyFromFile successfully retrieves a public key from a PEM-encoded file or fails the test.
func MustMakeRandomIdentifier ¶
MustMakeRandomIdentifier returns a random alphabetic identifier of length n, or fails the test.
func MustParseCSR ¶
func MustParseCSR(t *testing.T, reqPEM string) *x509.CertificateRequest
MustParseCSR successfully parses a PEM-encoded PKCS#10 certificate signing request or fails the test.
func MustParseCert ¶
func MustParseCert(t *testing.T, certPEM string) *x509.Certificate
MustParseCert successfully parses a PEM-encoded X509 certificate or fails the test.
func MustParseECPrivateKey ¶
func MustParseECPrivateKey(t *testing.T, keyPEM string) *ecdsa.PrivateKey
MustParseECPrivateKey successfully parses a PEM-encoded EC private key or fails the test.
func MustParseRSAPrivateKey ¶
func MustParseRSAPrivateKey(t *testing.T, keyPEM string) *rsa.PrivateKey
MustParseRSAPrivateKey successfully parses a PEM-encoded RSA private key or fails the test.
func MustParseURI ¶
MustParseURI successfully converts a string to a *url.URL or fails the test.
Types ¶
This section is empty.