test

package
v0.20240403.1135041 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DummyAccessToken = "" /* 4800-byte string literal not displayed */
	DummyIDToken     = "" /* 1139-byte string literal not displayed */
)

Variables

View Source
var (
	TestTokenIssued = time.Now()
	TestTokenExpiry = time.Now().Add(3599 * time.Second)
)
View Source
var (
	TenantId                      = os.Getenv("ARM_TENANT_ID")
	AuxiliaryTenantIds            = strings.Split(os.Getenv("ARM_AUXILIARY_TENANT_IDS"), ";")
	ClientId                      = os.Getenv("ARM_CLIENT_ID")
	ClientCertificate             = os.Getenv("ARM_CLIENT_CERTIFICATE")
	ClientCertificatePath         = os.Getenv("ARM_CLIENT_CERTIFICATE_PATH")
	ClientCertPassword            = os.Getenv("ARM_CLIENT_CERTIFICATE_PASSWORD")
	ClientSecret                  = os.Getenv("ARM_CLIENT_SECRET")
	Environment                   = envDefault("ARM_ENVIRONMENT", "global")
	GitHubTokenURL                = os.Getenv("ACTIONS_ID_TOKEN_REQUEST_URL")
	GitHubToken                   = os.Getenv("ACTIONS_ID_TOKEN_REQUEST_TOKEN")
	IdToken                       = os.Getenv("ARM_OIDC_TOKEN")
	CustomManagedIdentityEndpoint = os.Getenv("ARM_MSI_ENDPOINT")
)

Functions

func AccTest

func AccTest(t *testing.T)

func Base64DecodeCertificate

func Base64DecodeCertificate(t *testing.T, clientCertificate string) (pfx []byte)

Types

type AzureADAccessTokenMockClient

type AzureADAccessTokenMockClient struct {
	Authorization environments.Authorization
}

func (*AzureADAccessTokenMockClient) Do

type Connection

type Connection struct {
	AuthConfig auth.Credentials
	Authorizer auth.Authorizer
	Claims     *claims.Claims
}

func NewConnection

func NewConnection(t *testing.T) *Connection

NewConnection configures and returns a Connection for use in tests.

func (*Connection) Authorize

func (c *Connection) Authorize(ctx context.Context, t *testing.T, api environments.Api)

Authorize configures an Authorizer for the Connection

type TestAuthorizer

type TestAuthorizer struct{}

func (*TestAuthorizer) AuxiliaryTokens

func (*TestAuthorizer) AuxiliaryTokens(_ context.Context, _ *http.Request) ([]*oauth2.Token, error)

func (*TestAuthorizer) ExpireTokens

func (*TestAuthorizer) ExpireTokens() error

func (*TestAuthorizer) Token

Jump to

Keyboard shortcuts

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