import "github.com/levenlabs/golib/testutil"
Package testutil provides various methods which we commonly use when writing tests
crypto.go geoip.go round_tripper.go testutil.go
const ( // GeoIP2IPv4 contains the only IPv4 in the geoip2 test database // Location: Milton, Washington, US GeoIP2IPv4 = "216.160.83.56" // GeoIP2IPv6 contains the only IPv6 in the geoip2 test database // Finland, EU GeoIP2IPv6 = "2a02:d200::1" )
GeoIP2Reader returns a city database reader with only 1 ipv4 and 1 ipv6 address
RandInt64 returns a random integer. greater than or equal to 0, and less than 1 million. It's not necessary to do any seeding to use this method
RandStr returns a random alphanumeric string of arbitrary length. It's not necessary to do any seeding to use this method
SignedCert generates a PEM encoded certificate/key pair for the given domain. If parentCertPEM/parentKeyPEM are given the certificate will be signed by that parent, otherwise it will be self-signed. If domain is not given, the returned certificate will itself be a signing CA certificate
This function will panic if it receives invalid input or can't read from rand.Reader for some reason
type RoundTripper map[string]RoundTripperResponse
RoundTripper is an instance of a RoundTripper that allows you to pass the responses ahead of time per domain
RoundTrip is needed to implement the RoundTripper interface It checks for an existing response for the domain first, and then falls back to looking for an existing response for the full uri
Response is a response for a specific domain
Package testutil imports 12 packages (graph). Updated 2018-06-12. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).