testutil

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package testutil provides some common test functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnvOrDefault

func GetEnvOrDefault(key, defaultValue string) string

GetEnvOrDefault returns environment variable value or default

func IsLiveTesting

func IsLiveTesting() bool

IsLiveTesting returns true if running against live backend

func NewAPIClient

func NewAPIClient(t *testing.T) (*cmlclient.Client, func())

NewAPIClient creates a test API client - either mock or live based on TEST_LIVE env var

func NewAPIClientWithConfig

func NewAPIClientWithConfig(t *testing.T, config ClientConfig) (*cmlclient.Client, func())

NewAPIClientWithConfig creates a test API client with custom config

func RequireLive

func RequireLive(t *testing.T)

RequireLive skips the test if not running in live mode

func SetupCommonMocks

func SetupCommonMocks()

SetupCommonMocks sets up HTTP mocks common across all services

func SkipIfLive

func SkipIfLive(t *testing.T)

SkipIfLive skips the test if running in live mode

Types

type ClientConfig

type ClientConfig struct {
	BaseURL  string
	Username string
	Password string
	Token    string
}

ClientConfig holds configuration for test clients

func DefaultConfig

func DefaultConfig() ClientConfig

DefaultConfig returns default test configuration from environment

Jump to

Keyboard shortcuts

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