mocks

package
v0.0.0-...-40b0faf Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateEmptyHttpResponse

func CreateEmptyHttpResponse(request *http.Request, statusCode int) (*http.Response, error)

Creates a mocked HTTP response with the specified status code and no body

func CreateHttpResponseWithBody

func CreateHttpResponseWithBody[T any](request *http.Request, statusCode int, body T) (*http.Response, error)

Creates a mocked HTTP response with the specified status code and body

func NewMockUserAgentPolicy

func NewMockUserAgentPolicy(userAgent string) *mockUserAgentPolicy

Types

type MockContext

type MockContext struct {
	Credentials                    *MockCredentials
	Context                        *context.Context
	Console                        *mockinput.MockConsole
	HttpClient                     *mockhttp.MockHttpClient
	CoreClientOptions              *azcore.ClientOptions
	ArmClientOptions               *arm.ClientOptions
	CommandRunner                  *mockexec.MockCommandRunner
	ConfigManager                  *mockconfig.MockConfigManager
	Container                      *ioc.NestedContainer
	AlphaFeaturesManager           *alpha.FeatureManager
	SubscriptionCredentialProvider *MockSubscriptionCredentialProvider
	MultiTenantCredentialProvider  *MockMultiTenantCredentialProvider
	Config                         config.Config
	Clock                          *clock.Mock
}

func NewMockContext

func NewMockContext(ctx context.Context) *MockContext

type MockCredentials

type MockCredentials struct {
	GetTokenFn func(ctx context.Context, options policy.TokenRequestOptions) (azcore.AccessToken, error)
}

func (*MockCredentials) GetToken

type MockMultiTenantCredentialProvider

type MockMultiTenantCredentialProvider struct {
	TokenMap map[string]MockCredentials
}

func (*MockMultiTenantCredentialProvider) GetTokenCredential

func (c *MockMultiTenantCredentialProvider) GetTokenCredential(
	ctx context.Context, tenantId string) (azcore.TokenCredential, error)

type MockSubscriptionCredentialProvider

type MockSubscriptionCredentialProvider struct {
}

func (*MockSubscriptionCredentialProvider) CredentialForSubscription

func (scp *MockSubscriptionCredentialProvider) CredentialForSubscription(
	ctx context.Context,
	subscriptionId string,
) (azcore.TokenCredential, error)

Jump to

Keyboard shortcuts

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