test

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package test defines structs useful for testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cleanup

func Cleanup(t *testing.T, path string)

Cleanup deletes the directory the given file is in. Usually meant to be used in a deferred call.

func LoadTestFile

func LoadTestFile(t *testing.T, name string) string

LoadTestFile fetches the contents of the file from the testdata directory as a string.

func NewCredentials

func NewCredentials() *sts.Credentials

NewCredentials creates a new Credentials struct with populated values.

func PrepTempFile

func PrepTempFile(t *testing.T, p string)

PrepTempFile takes the directory of the given temp file and ensures that it exists.

Types

type ArrayInput

type ArrayInput struct {
	// contains filtered or unexported fields
}

ArrayInput implements input.Prompter where every subsequent call to Prompt returns a new response.

func NewArrayInput

func NewArrayInput(responses []string) *ArrayInput

NewArrayInput creates a new ArrayInput struct.

func (*ArrayInput) Prompt

func (i *ArrayInput) Prompt(msg string) (string, error)

Prompt returns a new response based on how many calls have been made previously.

func (*ArrayInput) PromptPassword

func (i *ArrayInput) PromptPassword(msg string) (string, error)

PromptPassword just returns the inputted message.

type MockSTS

type MockSTS struct {
	stsiface.STSAPI
	Creds    *sts.Credentials
	Duration int64
}

MockSTS is a mock for the AWS STS service.

func (*MockSTS) AssumeRoleWithSAML

func (m *MockSTS) AssumeRoleWithSAML(in *sts.AssumeRoleWithSAMLInput) (*sts.AssumeRoleWithSAMLOutput, error)

AssumeRoleWithSAML takes in an AssumeRoleWithSAMLInput and returns AssumeRoleWithSAMLOutput.

type NoopInput

type NoopInput struct{}

NoopInput implements input.Prompter but doesn't have any side-effects.

func NewNoopInput

func NewNoopInput() *NoopInput

NewNoopInput creates a new NoopInput struct.

func (NoopInput) Prompt

func (i NoopInput) Prompt(msg string) (string, error)

Prompt just returns the inputted message.

func (NoopInput) PromptPassword

func (i NoopInput) PromptPassword(msg string) (string, error)

PromptPassword just returns the inputted message.

Jump to

Keyboard shortcuts

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