testutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScenarioPrefix = "PARITY_SCENARIO:"
	DefaultModel   = "claude-sonnet-4-6"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CapturedRequest

type CapturedRequest struct {
	Method   string            `json:"method"`
	Path     string            `json:"path"`
	Headers  map[string]string `json:"headers"`
	Scenario string            `json:"scenario"`
	Stream   bool              `json:"stream"`
	RawBody  string            `json:"raw_body"`
}

CapturedRequest records a single request made to the mock service.

type MockAnthropicService

type MockAnthropicService struct {
	// contains filtered or unexported fields
}

MockAnthropicService simulates an Anthropic API server for integration tests.

func SpawnMockService

func SpawnMockService() *MockAnthropicService

SpawnMockService creates and starts a new mock Anthropic service.

func (*MockAnthropicService) BaseURL

func (s *MockAnthropicService) BaseURL() string

BaseURL returns the URL of the mock server.

func (*MockAnthropicService) CapturedRequests

func (s *MockAnthropicService) CapturedRequests() []CapturedRequest

CapturedRequests returns a copy of all captured requests.

func (*MockAnthropicService) Close

func (s *MockAnthropicService) Close()

Close shuts down the mock server.

type Scenario

type Scenario int

Scenario identifies a mock response pattern.

const (
	ScenarioStreamingText Scenario = iota
	ScenarioReadFileRoundtrip
	ScenarioGrepChunkAssembly
	ScenarioWriteFileAllowed
	ScenarioWriteFileDenied
	ScenarioMultiToolTurnRoundtrip
	ScenarioBashStdoutRoundtrip
	ScenarioBashPermissionPromptApproved
	ScenarioBashPermissionPromptDenied
	ScenarioPluginToolRoundtrip
	ScenarioAutoCompactTriggered
	ScenarioTokenCostReporting
	ScenarioRateLimited429
	ScenarioAuthFailure401
	ScenarioAuthForbidden403
	ScenarioContextWindowExceeded
	ScenarioChunkedSSE
)

func ParseScenario

func ParseScenario(name string) (Scenario, bool)

ParseScenario converts a string to a Scenario, returning ok=false if unknown.

func (Scenario) Name

func (s Scenario) Name() string

Name returns the string identifier for a scenario.

Jump to

Keyboard shortcuts

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