githubtest

package
v0.5.35 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package githubtest is a test server of the parts of the GitHub REST API that package github uses, with repositories in memory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	*httptest.Server

	// Token, if set, is the token that the requests must have.
	Token string

	// Requests is the number of requests to the server, without
	// those that are not modified, as for the rate limit.
	Requests int
	// contains filtered or unexported fields
}

Server is a test server of the GitHub REST API, as for a github.Client with [Server.URL] as its API. The repositories are made when they are first used, without commits.

func NewServer

func NewServer() *Server

NewServer returns a new running test server, to be closed after use.

func (*Server) Client

func (s *Server) Client() *github.Client

Client returns a new client of the server.

func (*Server) Commits

func (s *Server) Commits(repoName, branch string) []string

Commits returns the messages of the commits of the given branch of the given repository, from the last one, along the first parents.

func (*Server) Files

func (s *Server) Files(repoName, branch string) map[string][]byte

Files returns the files of the last commit of the given branch of the given repository, by path, or nil if it has none.

Jump to

Keyboard shortcuts

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