testutil

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: May 26, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureOutput

func CaptureOutput(t *testing.T, f func()) (stdout, stderr string)

CaptureOutput captures stdout and stderr during a test

func CreateTestToken

func CreateTestToken(t *testing.T, expired bool) *oauth2.Token

CreateTestToken creates a test OAuth2 token

func MockDeviceFlowServer

func MockDeviceFlowServer(t *testing.T) *httptest.Server

MockDeviceFlowServer creates a mock server for GitHub's device flow

func MockGitHubAPI

func MockGitHubAPI(t *testing.T, handlers map[string]http.HandlerFunc) *httptest.Server

MockGitHubAPI creates a mock GitHub API server

func ReadTestFile

func ReadTestFile(t *testing.T, filename string) []byte

ReadTestFile reads a test file from the testdata directory

func SetEnvVars

func SetEnvVars(t *testing.T, vars map[string]string) func()

SetEnvVars sets environment variables for testing and returns a cleanup function

func SetupTestConfig

func SetupTestConfig(t *testing.T) (string, func())

SetupTestConfig creates a test configuration in a temporary directory

func TempDir

func TempDir(t *testing.T) (string, func())

TempDir creates a temporary directory for testing and returns a cleanup function

Types

This section is empty.

Jump to

Keyboard shortcuts

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