mock

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 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 (
	SearchRepositories = EndpointPattern{Pattern: "/api/latest/repos", Method: "GET"}
	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"}
	SearchBranches     = EndpointPattern{Pattern: "/api/latest/projects/:projectKey/repos/:repositorySlug/branches", Method: "GET"}
	GetDefaultBranch   = EndpointPattern{Pattern: "/api/latest/projects/:projectKey/repos/:repositorySlug/branches/default", Method: "GET"}
	SearchCommits      = EndpointPattern{Pattern: "/api/latest/projects/:projectKey/repos/:repositorySlug/commits", Method: "GET"}
	GetCommit          = EndpointPattern{Pattern: "/api/latest/projects/:projectKey/repos/:repositorySlug/commits/:commitId", Method: "GET"}
	SearchPullRequests = EndpointPattern{Pattern: "/api/latest/projects/:projectKey/repos/:repositorySlug/pull-requests", Method: "GET"}
	GetPullRequest     = EndpointPattern{Pattern: "/api/latest/projects/:projectKey/repos/:repositorySlug/pull-requests/:pullRequestId", Method: "GET"}
	ListWebhooks       = EndpointPattern{Pattern: "/api/latest/projects/:projectKey/repos/:repositorySlug/webhooks", Method: "GET"}
	GetWebhook         = EndpointPattern{Pattern: "/api/latest/projects/:projectKey/repos/:repositorySlug/webhooks/:id", Method: "GET"}
	CreateWebhook      = EndpointPattern{Pattern: "/api/latest/projects/:projectKey/repos/:repositorySlug/webhooks", Method: "POST"}
	DeleteWebhook      = EndpointPattern{Pattern: "/api/latest/projects/:projectKey/repos/:repositorySlug/webhooks/:id", Method: "DELETE"}
)
View Source
var (
	GetUser = EndpointPattern{Pattern: "/api/latest/users/:userSlug", Method: "GET"}
)

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