testutils

package
v1.13.3 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const Secret = "0123456789101112"

Variables

This section is empty.

Functions

func NewTestLogger

func NewTestLogger() *slog.Logger

func ReadLine

func ReadLine(tb testing.TB, reader *bufio.Reader) string

func SendLine

func SendLine(tb testing.TB, conn net.Conn, msg string, a ...any)

func SetupMockEnvironment added in v1.13.0

func SetupMockEnvironment(tb testing.TB, conf config.Config) (
	config.Config, *openvpn.Client, net.Listener,
	*oauth2.Provider, *httptest.Server, *http.Client, func(),
)

SetupMockEnvironment setups an OpenVPN and IDP mock

func SetupResourceServer

func SetupResourceServer(tb testing.TB, clientListener net.Listener) (*httptest.Server, *url.URL, config.OAuth2Client, error)

func TCPTestListener added in v1.13.0

func TCPTestListener(tb testing.TB) net.Listener

Types

type Logger

type Logger struct{}

func (Logger) Enabled

func (l Logger) Enabled(_ context.Context, _ slog.Level) bool

func (Logger) Handle

func (l Logger) Handle(_ context.Context, _ slog.Record) error

func (Logger) WithAttrs

func (l Logger) WithAttrs(_ []slog.Attr) slog.Handler

func (Logger) WithGroup

func (l Logger) WithGroup(_ string) slog.Handler

Jump to

Keyboard shortcuts

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