fakes

package
v0.7.12 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSSHKeypair added in v0.7.9

func GenerateSSHKeypair(t *testing.T) (keyFile string, pubKey ssh.PublicKey)

GenerateSSHKeypair generates an ed25519 keypair, writes the private and public key files to a temp directory, and returns the private key file path and the corresponding ssh.PublicKey.

Types

type Collaboration

type Collaboration struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	VCSType string `json:"vcs-type"`
	Slug    string `json:"slug"`
}

type ExecResponse

type ExecResponse struct {
	CommandID string `json:"command_id"`
	PID       int    `json:"pid"`
	Stdout    string `json:"stdout"`
	Stderr    string `json:"stderr"`
	ExitCode  int    `json:"exit_code"`
}

type FakeAnthropic

type FakeAnthropic struct {
	http.Handler
	Recorder *recorder.RequestRecorder
	// contains filtered or unexported fields
}

FakeAnthropic serves canned responses for the Anthropic Messages API.

func NewFakeAnthropic

func NewFakeAnthropic(responses ...string) *FakeAnthropic

func (*FakeAnthropic) SetTokenLimitErrors

func (f *FakeAnthropic) SetTokenLimitErrors(n int)

SetTokenLimitErrors configures the fake to return n consecutive "prompt is too long" errors before returning normal responses.

type FakeCircleCI

type FakeCircleCI struct {
	http.Handler
	Recorder *recorder.RequestRecorder

	Collaborations []Collaboration
	Projects       []Project
	Sandboxes      []Sandbox
	RunResponse    *RunResponse
	AddKeyURL      string
	ExecResponse   *ExecResponse
	RunStatusCode  int // override status code for trigger run endpoint

	// Per-endpoint status code overrides for testing error responses.
	ListStatusCode   int // override for GET /sandbox/instances
	CreateStatusCode int // override for POST /sandbox/instances
	ExecStatusCode   int // override for POST /sandbox/instances/:id/exec
	AddKeyStatusCode int // override for POST /sandbox/instances/:id/ssh/add-key
	// contains filtered or unexported fields
}

FakeCircleCI serves canned responses for the CircleCI API.

func NewFakeCircleCI

func NewFakeCircleCI() *FakeCircleCI

type FakeGitHub

type FakeGitHub struct {
	http.Handler
	Recorder *recorder.RequestRecorder
	// contains filtered or unexported fields
}

FakeGitHub serves canned responses for GitHub's GraphQL API.

func NewFakeGitHub

func NewFakeGitHub() *FakeGitHub

func (*FakeGitHub) SetOrgRepos

func (f *FakeGitHub) SetOrgRepos(resp string)

func (*FakeGitHub) SetOrgValidation

func (f *FakeGitHub) SetOrgValidation(resp string)

func (*FakeGitHub) SetRateLimit

func (f *FakeGitHub) SetRateLimit(resp string)

func (*FakeGitHub) SetRepoError

func (f *FakeGitHub) SetRepoError(repo string, resp string)

func (*FakeGitHub) SetReviewActivity

func (f *FakeGitHub) SetReviewActivity(repo string, resp string)

type Project

type Project struct {
	VCSType  string `json:"vcs_type"`
	Username string `json:"username"`
	Reponame string `json:"reponame"`
}

type RunResponse

type RunResponse struct {
	RunID      string `json:"runId,omitempty"`
	PipelineID string `json:"pipelineId,omitempty"`
}

type SSHServer added in v0.7.9

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

SSHServer is a TLS+SSH server for testing SSH-based sandbox interactions. It accepts a single authorized public key and records exec requests.

func NewSSHServer added in v0.7.9

func NewSSHServer(t *testing.T, authorizedKey ssh.PublicKey) *SSHServer

NewSSHServer starts a TLS+SSH server that accepts connections authenticated with authorizedKey. The server is shut down automatically when the test ends.

func (*SSHServer) Addr added in v0.7.9

func (s *SSHServer) Addr() string

Addr returns the "host:port" address the server is listening on.

func (*SSHServer) Commands added in v0.7.9

func (s *SSHServer) Commands() []string

Commands returns a copy of all exec command strings received so far.

func (*SSHServer) SetResult added in v0.7.9

func (s *SSHServer) SetResult(stdout string, exitCode int)

SetResult configures the stdout output and exit code returned for exec requests.

type Sandbox

type Sandbox struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	OrganizationID string `json:"organization_id"`
	Image          string `json:"image,omitempty"`
}

Jump to

Keyboard shortcuts

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