hostproxytest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackData

type CallbackData struct {
	SessionID     string
	OriginalPort  string
	CallbackPath  string
	CapturedPath  string // Path captured from OAuth redirect
	CapturedQuery string // Query captured from OAuth redirect
	Ready         bool   // Whether callback data is ready
}

CallbackData holds data for an OAuth callback session.

type GitCredRequest

type GitCredRequest struct {
	Action   string // "get", "store", or "erase"
	Host     string
	Protocol string
	Username string
}

GitCredRequest represents a git credential request.

type MockHostProxy

type MockHostProxy struct {
	Server *httptest.Server

	OpenedURLs []string                 // URLs received at /open/url
	Callbacks  map[string]*CallbackData // Registered callback sessions
	GitCreds   []GitCredRequest         // Git credential requests
	// contains filtered or unexported fields
}

MockHostProxy provides a mock implementation of the clawker host proxy for testing container scripts that communicate with the host.

func NewMockHostProxy

func NewMockHostProxy(t *testing.T) *MockHostProxy

NewMockHostProxy creates a new MockHostProxy and starts the server. The server is automatically stopped when the test completes.

func (*MockHostProxy) GetGitCreds

func (m *MockHostProxy) GetGitCreds() []GitCredRequest

GetGitCreds returns a copy of the git credential requests.

func (*MockHostProxy) GetOpenedURLs

func (m *MockHostProxy) GetOpenedURLs() []string

GetOpenedURLs returns a copy of the opened URLs.

func (*MockHostProxy) SetCallbackReady

func (m *MockHostProxy) SetCallbackReady(sessionID, path, query string)

SetCallbackReady simulates an OAuth callback being received.

func (*MockHostProxy) SetHealthOK

func (m *MockHostProxy) SetHealthOK(ok bool)

SetHealthOK controls the health check response.

func (*MockHostProxy) URL

func (m *MockHostProxy) URL() string

URL returns the mock proxy's URL.

Jump to

Keyboard shortcuts

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