pubapimock

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchesProto

func MatchesProto(expected proto.Message) interface{}

func New

func New(t tiface.T) (*API, BaseResources)

New returns mock configured for most happy path tests. * Endpoints server returns mock server addr for all ids. * Credentials set to some OAuth token, and IAMToken server returns some IAM Token for it. * Resource manager configured to serve Get/List requests for one Cloud with one Folder.

func RandID

func RandID() string

Types

type API

type API struct {
	IAM             IAM
	ResourceManager ResourceManager
	// Just add generated mock as a field: it will be initialized and served automagically.
	Compute     Compute
	APIEndpoint APIEndpoint
	// contains filtered or unexported fields
}

API is helper to mock public API on server side.

func NewRaw

func NewRaw(t tiface.T) *API

NewRaw return API without any mocks configuration.

func (*API) Addr

func (api *API) Addr() string

func (*API) Close

func (api *API) Close()

func (*API) MockEndpoint

func (api *API) MockEndpoint()

func (*API) MockIAMToken

func (api *API) MockIAMToken()

func (*API) SDK

func (api *API) SDK(t tiface.T) *ycsdk.SDK

type APIEndpoint

type APIEndpoint struct {
	APIEndpoint *endpointmocks.ApiEndpointServiceServer
}

type BaseResources

type BaseResources struct {
	CloudID  string
	FolderID string
}

type IAM

type IAM struct {
	IAMToken       *iammocks.IamTokenServiceServer
	ServiceAccount *iammocks.ServiceAccountServiceServer
}

type ResourceManager

type ResourceManager struct {
	Cloud  *resourcemanagermocks.CloudServiceServer
	Folder *resourcemanagermocks.FolderServiceServer
}

func (*ResourceManager) MockCloud

func (rm *ResourceManager) MockCloud() string

func (*ResourceManager) MockFolder

func (rm *ResourceManager) MockFolder(cloudID string) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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