{"modulePath":"github.com/hookdeck/hookdeck-cli","version":"v1.9.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package acceptance\n\n## Functions\n\n```go\nfunc GetCurrentOrgAndProject(t *testing.T) (org, project string)\n```\nGetCurrentOrgAndProject returns the current organization and project from whoami. This is useful for tests that need to know which project they're working with.\n\n```go\nfunc ParseOrgAndProjectFromWhoami(t *testing.T, whoamiOutput string) (org, project string)\n```\nParseOrgAndProjectFromWhoami extracts organization and project names from whoami output. Expected format: \"Logged in as ... on project PROJECT\\_NAME in organization ORG\\_NAME\"\n\n```go\nfunc RequireCLIAuthentication(t *testing.T) string\n```\nRequireCLIAuthentication forces fresh CLI authentication for tests that need human interaction. This helper: 1. Clears any existing authentication 2. Runs \\`hookdeck login\\` for the user 3. Prompts user to complete browser authentication 4. Waits for user confirmation (Enter key) 5. Verifies authentication succeeded via \\`hookdeck whoami\\` 6. Fails the test if authentication doesn't succeed\n\nThis ensures tests always run with fresh human-interactive CLI login.\n\n```go\nfunc RequireCLIAuthenticationOnce(t *testing.T) string\n```\n\n## Types\n\n```go\ntype Attempt struct {\n\tID            string `json:\"id\"`\n\tEventID       string `json:\"event_id\"`\n\tAttemptNumber int    `json:\"attempt_number\"`\n\tStatus        string `json:\"status\"`\n}\n```\nAttempt represents a Hookdeck attempt for testing\n\n```go\ntype CLIRunner struct {\n\t// contains filtered or unexported fields\n}\n```\nCLIRunner provides utilities for running CLI commands in tests\n\n```go\nfunc NewCLIRunner(t *testing.T) *CLIRunner\n```\nNewCLIRunner creates a new CLI runner for tests It requires HOOKDECK\\_CLI\\_TESTING\\_API\\_KEY environment variable to be set\n\n```go\nfunc NewManualCLIRunner(t *testing.T) *CLIRunner\n```\nNewManualCLIRunner creates a CLI runner for manual tests that use human authentication. Unlike NewCLIRunner, this does NOT run \\`hookdeck ci\\` and relies on existing CLI credentials from \\`hookdeck login\\`.\n\n```go\nfunc (r *CLIRunner) Run(args ...string) (stdout, stderr string, err error)\n```\nRun executes the CLI with the given arguments and returns stdout, stderr, and error The CLI is executed via \\`go run main.go\\` from the project root\n\n```go\nfunc (r *CLIRunner) RunExpectSuccess(args ...string) string\n```\nRunExpectSuccess runs the CLI command and fails the test if it returns an error Returns only stdout for convenience\n\n```go\nfunc (r *CLIRunner) RunFromCwd(args ...string) (stdout, stderr string, err error)\n```\nRunFromCwd executes the CLI from the current working directory. This is useful for tests that need to test --local flag behavior, which creates config in the current directory.\n\nThis builds a temporary binary in the project root, then runs it from the current working directory.\n\n```go\nfunc (r *CLIRunner) RunJSON(result interface{}, args ...string) error\n```\nRunJSON runs the CLI command with --output json flag and unmarshals the result Automatically adds --output json to the arguments\n\n```go\ntype Connection struct {\n\tID          string `json:\"id\"`\n\tName        string `json:\"name\"`\n\tDescription string `json:\"description\"`\n\tSource      struct {\n\t\tID   string `json:\"id\"`\n\t\tName string `json:\"name\"`\n\t\tType string `json:\"type\"`\n\t} `json:\"source\"`\n\tDestination struct {\n\t\tID     string      `json:\"id\"`\n\t\tName   string      `json:\"name\"`\n\t\tType   string      `json:\"type\"`\n\t\tConfig interface{} `json:\"config\"`\n\t} `json:\"destination\"`\n\tRules []map[string]interface{} `json:\"rules\"`\n}\n```\nConnection represents a Hookdeck connection for testing\n\n```go\ntype Destination struct {\n\tID     string      `json:\"id\"`\n\tName   string      `json:\"name\"`\n\tType   string      `json:\"type\"`\n\tConfig interface{} `json:\"config\"`\n}\n```\nDestination represents a Hookdeck destination for testing\n\n```go\ntype Event struct {\n\tID        string `json:\"id\"`\n\tStatus    string `json:\"status\"`\n\tWebhookID string `json:\"webhook_id\"`\n}\n```\nEvent represents a Hookdeck event for testing\n\n```go\ntype Request struct {\n\tID string `json:\"id\"`\n}\n```\nRequest represents a Hookdeck request for testing\n\n```go\ntype Source struct {\n\tID   string `json:\"id\"`\n\tName string `json:\"name\"`\n\tType string `json:\"type\"`\n\tURL  string `json:\"url\"`\n}\n```\nSource represents a Hookdeck source for testing\n\n```go\ntype Transformation struct {\n\tID   string `json:\"id\"`\n\tName string `json:\"name\"`\n\tCode string `json:\"code\"`\n}\n```\nTransformation represents a Hookdeck transformation for testing\n\n","path":"github.com/hookdeck/hookdeck-cli/test/acceptance","name":"acceptance","synopsis":"","isRedistributable":true}
