mock

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ListAccessTokensRepository  = EndpointPattern{Pattern: "/access-tokens/latest/projects/:projectKey/repos/:repositorySlug", Method: "GET"}
	GetAccessTokenRepository    = EndpointPattern{Pattern: "/access-tokens/latest/projects/:projectKey/repos/:repositorySlug/:tokenId", Method: "GET"}
	CreateAccessTokenRepository = EndpointPattern{Pattern: "/access-tokens/latest/projects/:projectKey/repos/:repositorySlug", Method: "PUT"}
	DeleteAccessTokenRepository = EndpointPattern{Pattern: "/access-tokens/latest/projects/:projectKey/repos/:repositorySlug/:tokenId", Method: "DELETE"}
)
View Source
var (
	ListAccessTokensUser  = EndpointPattern{Pattern: "/access-tokens/latest/users/:userSlug", Method: "GET"}
	GetAccessTokenUser    = EndpointPattern{Pattern: "/access-tokens/latest/users/:userSlug/:tokenId", Method: "GET"}
	CreateAccessTokenUser = EndpointPattern{Pattern: "/access-tokens/latest/users/:userSlug", Method: "PUT"}
	DeleteAccessTokenUser = EndpointPattern{Pattern: "/access-tokens/latest/users/:userSlug/:tokenId", Method: "DELETE"}
)
View Source
var (
	ListKeysRepository  = EndpointPattern{Pattern: "/keys/latest/projects/:projectKey/repos/:repositorySlug/ssh", Method: "GET"}
	GetKeyRepository    = EndpointPattern{Pattern: "/keys/latest/projects/:projectKey/repos/:repositorySlug/ssh/:keyId", Method: "GET"}
	CreateKeyRepository = EndpointPattern{Pattern: "/keys/latest/projects/:projectKey/repos/:repositorySlug/ssh", Method: "POST"}
	DeleteKeyRepository = EndpointPattern{Pattern: "/keys/latest/projects/:projectKey/repos/:repositorySlug/ssh/:keyId", Method: "DELETE"}
)
View Source
var (
	ListRepositories = EndpointPattern{Pattern: "/api/latest/projects/:projectKey/repos", Method: "GET"}
	GetRepository    = EndpointPattern{Pattern: "/api/latest/projects/:projectKey/repos/:repositorySlug", Method: "GET"}
	CreateRepository = EndpointPattern{Pattern: "/api/latest/projects/:projectKey/repos", Method: "POST"}
	DeleteRepository = EndpointPattern{Pattern: "/api/latest/projects/:projectKey/repos/:repositorySlug", Method: "DELETE"}
)

Functions

func NewMockServer

func NewMockServer(opts ...MockBackendOption) *httptest.Server

func WriteError

func WriteError(w http.ResponseWriter, status int, errs []bitbucket.ErrorMessage)

Types

type EndpointPattern

type EndpointPattern struct {
	Pattern string
	Method  string
}

type FIFOReponseHandler

type FIFOReponseHandler struct {
	Responses    [][]byte
	CurrentIndex int
	// contains filtered or unexported fields
}

func (*FIFOReponseHandler) ServeHTTP

func (h *FIFOReponseHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type MockBackendOption

type MockBackendOption func(*httprouter.Router)

func WithRequestMatch

func WithRequestMatch(ep EndpointPattern, responsesFIFO ...interface{}) MockBackendOption

func WithRequestMatchHandler

func WithRequestMatchHandler(ep EndpointPattern, handler http.Handler) MockBackendOption

Jump to

Keyboard shortcuts

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