fakegithub

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fakegithub is a mock of the GitHub REST API badil calls, served under /api/v3/ from in-memory state, with a control API under /_mock/ that changes the state and sends the matching signed webhook to badil. It is a dev and test tool, not part of badil's release.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// WebURL is the web base of every html_url and repo URL, without a
	// trailing "/" (badil's GITHUB_URL).
	WebURL string
	// WebhookURL is where webhooks are sent: badil's .../webhooks/github.
	WebhookURL string
	// WebhookSecret signs every webhook (X-Hub-Signature-256).
	WebhookSecret string
	// InstallationID is the only installation the mock knows; every webhook
	// carries it.
	InstallationID int64
	// AppSlug is the App's slug; its bot user is <AppSlug>[bot].
	AppSlug string
	// BotUserID is the user id of the App's bot.
	BotUserID int64
	// TokenTTL is the lifetime of issued installation tokens, defaultTokenTTL
	// when zero.
	TokenTTL time.Duration
}

Config configures a Server.

type Server

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

Server is the mock. Its state lives in memory, guarded by mu.

func New

func New(cfg Config) *Server

New returns a mock configured by cfg, with no repositories.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the mock's HTTP handler: the API under /api/v3/ and the control API under /_mock/.

Jump to

Keyboard shortcuts

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