mocks

package
v3.0.0-...-c77a060 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CliContext

type CliContext struct {
	mock.Mock
}

func (*CliContext) App

func (c *CliContext) App() *cli.App

func (*CliContext) Args

func (c *CliContext) Args() cli.Args

func (*CliContext) Bool

func (c *CliContext) Bool(name string) bool

func (*CliContext) BoolT

func (c *CliContext) BoolT(name string) bool

func (*CliContext) Command

func (c *CliContext) Command() cli.Command

func (*CliContext) Duration

func (c *CliContext) Duration(name string) time.Duration

func (*CliContext) FlagNames

func (c *CliContext) FlagNames() (names []string)

func (*CliContext) Float64

func (c *CliContext) Float64(name string) float64

func (*CliContext) Generic

func (c *CliContext) Generic(name string) interface{}

func (*CliContext) GlobalBool

func (c *CliContext) GlobalBool(name string) bool

func (*CliContext) GlobalBoolT

func (c *CliContext) GlobalBoolT(name string) bool

func (*CliContext) GlobalDuration

func (c *CliContext) GlobalDuration(name string) time.Duration

func (*CliContext) GlobalFlagNames

func (c *CliContext) GlobalFlagNames() (names []string)

func (*CliContext) GlobalFloat64

func (c *CliContext) GlobalFloat64(name string) float64

func (*CliContext) GlobalGeneric

func (c *CliContext) GlobalGeneric(name string) interface{}

func (*CliContext) GlobalInt

func (c *CliContext) GlobalInt(name string) int

func (*CliContext) GlobalInt64

func (c *CliContext) GlobalInt64(name string) int64

func (*CliContext) GlobalInt64Slice

func (c *CliContext) GlobalInt64Slice(name string) []int64

func (*CliContext) GlobalIntSlice

func (c *CliContext) GlobalIntSlice(name string) []int

func (*CliContext) GlobalIsSet

func (c *CliContext) GlobalIsSet(name string) bool

func (*CliContext) GlobalSet

func (c *CliContext) GlobalSet(name, value string) error

func (*CliContext) GlobalString

func (c *CliContext) GlobalString(name string) string

func (*CliContext) GlobalStringSlice

func (c *CliContext) GlobalStringSlice(name string) []string

func (*CliContext) GlobalUint

func (c *CliContext) GlobalUint(name string) uint

func (*CliContext) GlobalUint64

func (c *CliContext) GlobalUint64(name string) uint64

func (*CliContext) Int

func (c *CliContext) Int(name string) int

func (*CliContext) Int64

func (c *CliContext) Int64(name string) int64

func (*CliContext) Int64Slice

func (c *CliContext) Int64Slice(name string) []int64

func (*CliContext) IntSlice

func (c *CliContext) IntSlice(name string) []int

func (*CliContext) IsSet

func (c *CliContext) IsSet(name string) bool

func (*CliContext) NArg

func (c *CliContext) NArg() int

func (*CliContext) NumFlags

func (c *CliContext) NumFlags() int

func (*CliContext) Parent

func (c *CliContext) Parent() *cli.Context

func (*CliContext) Set

func (c *CliContext) Set(name, value string) error

func (*CliContext) String

func (c *CliContext) String(name string) string

func (*CliContext) StringSlice

func (c *CliContext) StringSlice(name string) []string

func (*CliContext) Uint

func (c *CliContext) Uint(name string) uint

func (*CliContext) Uint64

func (c *CliContext) Uint64(name string) uint64

type Client

type Client struct {
	mock.Mock
	MockRequest *Request
}

func (*Client) AddIP

func (c *Client) AddIP(name lib.VirtualMachineName, spec brain.IPCreateRequest) (brain.IPs, error)

func (*Client) AddUserAuthorizedKey

func (c *Client) AddUserAuthorizedKey(name, key string) error

func (*Client) AdminCreateGroup

func (c *Client) AdminCreateGroup(name lib.GroupName, vlanNum int) error

func (*Client) AllowInsecureRequests

func (c *Client) AllowInsecureRequests()

func (*Client) ApproveVM

func (c *Client) ApproveVM(name lib.VirtualMachineName, powerOn bool) error

func (*Client) AuthWithCredentials

func (c *Client) AuthWithCredentials(credents auth3.Credentials) error

func (*Client) AuthWithToken

func (c *Client) AuthWithToken(token string) error

func (*Client) BuildRequest

func (c *Client) BuildRequest(method string, endpoint lib.Endpoint, path string, parts ...string) (lib.Request, error)

func (*Client) BuildRequestNoAuth

func (c *Client) BuildRequestNoAuth(method string, endpoint lib.Endpoint, path string, parts ...string) (lib.Request, error)

func (*Client) CancelDiscMigration

func (c *Client) CancelDiscMigration(id int) error

func (*Client) CancelVMMigration

func (c *Client) CancelVMMigration(id int) error

func (*Client) CreateAccount

func (c *Client) CreateAccount(acc lib.Account) (lib.Account, error)

func (*Client) CreateBackup

func (c *Client) CreateBackup(server lib.VirtualMachineName, discLabelOrID string) (brain.Backup, error)

func (*Client) CreateBackupSchedule

func (c *Client) CreateBackupSchedule(server lib.VirtualMachineName, discLabelOrID string, start string, interval int) (brain.BackupSchedule, error)

func (*Client) CreateCreditCard

func (c *Client) CreateCreditCard(cc spp.CreditCard) (string, error)

func (*Client) CreateCreditCardWithToken

func (c *Client) CreateCreditCardWithToken(cc spp.CreditCard, token string) (string, error)

func (*Client) CreateDisc

func (c *Client) CreateDisc(name lib.VirtualMachineName, disc brain.Disc) error

func (*Client) CreateGroup

func (c *Client) CreateGroup(name lib.GroupName) error

func (*Client) CreateIPRange

func (c *Client) CreateIPRange(ipRange string, vlanNum int) error

func (*Client) CreateUser

func (c *Client) CreateUser(username string, privilege string) error

func (*Client) CreateVirtualMachine

func (c *Client) CreateVirtualMachine(group lib.GroupName, vm brain.VirtualMachineSpec) (brain.VirtualMachine, error)

func (*Client) DeleteBackup

func (c *Client) DeleteBackup(server lib.VirtualMachineName, discLabelOrID string, backupLabelOrID string) error

func (*Client) DeleteBackupSchedule

func (c *Client) DeleteBackupSchedule(server lib.VirtualMachineName, discLabelOrID string, id int) error

func (*Client) DeleteDisc

func (c *Client) DeleteDisc(name lib.VirtualMachineName, disc string) error

func (*Client) DeleteGroup

func (c *Client) DeleteGroup(name lib.GroupName) error

func (*Client) DeleteUserAuthorizedKey

func (c *Client) DeleteUserAuthorizedKey(name, key string) error

func (*Client) DeleteVLAN

func (c *Client) DeleteVLAN(id int) error

func (*Client) DeleteVirtualMachine

func (c *Client) DeleteVirtualMachine(name lib.VirtualMachineName, purge bool) error

func (*Client) EmptyHead

func (c *Client) EmptyHead(idOrLabel string) error

func (*Client) EmptyStoragePool

func (c *Client) EmptyStoragePool(idOrLabel string) error

func (*Client) EnsureAccountName

func (c *Client) EnsureAccountName(name *string) error

func (*Client) EnsureGroupName

func (c *Client) EnsureGroupName(name *lib.GroupName) error

func (*Client) EnsureVirtualMachineName

func (c *Client) EnsureVirtualMachineName(name *lib.VirtualMachineName) error

func (*Client) GetAccount

func (c *Client) GetAccount(name string) (account lib.Account, err error)

func (*Client) GetAccounts

func (c *Client) GetAccounts() (accounts lib.Accounts, err error)

func (*Client) GetBackups

func (c *Client) GetBackups(server lib.VirtualMachineName, discLabelOrID string) (brain.Backups, error)

func (*Client) GetDefaultAccount

func (c *Client) GetDefaultAccount() (account lib.Account, err error)

func (*Client) GetDisc

func (c *Client) GetDisc(name lib.VirtualMachineName, discId string) (disc brain.Disc, err error)

func (*Client) GetDiscByID

func (c *Client) GetDiscByID(id int) (disc brain.Disc, err error)

func (*Client) GetEndpoint

func (c *Client) GetEndpoint() string

func (*Client) GetGroup

func (c *Client) GetGroup(name lib.GroupName) (brain.Group, error)

func (*Client) GetHead

func (c *Client) GetHead(idOrLabel string) (brain.Head, error)

func (*Client) GetHeads

func (c *Client) GetHeads() (brain.Heads, error)

func (*Client) GetIPRange

func (c *Client) GetIPRange(idOrCIDR string) (brain.IPRange, error)

func (*Client) GetIPRanges

func (c *Client) GetIPRanges() (brain.IPRanges, error)

func (*Client) GetMigratingDiscs

func (c *Client) GetMigratingDiscs() (brain.Discs, error)

func (*Client) GetMigratingVMs

func (c *Client) GetMigratingVMs() (brain.VirtualMachines, error)

func (*Client) GetPrivileges

func (c *Client) GetPrivileges(username string) (privs brain.Privileges, err error)

func (*Client) GetPrivilegesForAccount

func (c *Client) GetPrivilegesForAccount(accountName string) (privs brain.Privileges, err error)

func (*Client) GetPrivilegesForGroup

func (c *Client) GetPrivilegesForGroup(group lib.GroupName) (privs brain.Privileges, err error)

func (*Client) GetPrivilegesForVirtualMachine

func (c *Client) GetPrivilegesForVirtualMachine(vm lib.VirtualMachineName) (privs brain.Privileges, err error)

func (*Client) GetRecentVMs

func (c *Client) GetRecentVMs() (brain.VirtualMachines, error)

func (*Client) GetSPPToken

func (c *Client) GetSPPToken(cc spp.CreditCard, owner billing.Person) (string, error)

func (*Client) GetSessionFactors

func (c *Client) GetSessionFactors() []string

func (*Client) GetSessionToken

func (c *Client) GetSessionToken() string

func (*Client) GetSessionUser

func (c *Client) GetSessionUser() string

func (*Client) GetStoppedEligibleVMs

func (c *Client) GetStoppedEligibleVMs() (brain.VirtualMachines, error)

func (*Client) GetStoragePool

func (c *Client) GetStoragePool(idOrLabel string) (brain.StoragePool, error)

func (*Client) GetStoragePools

func (c *Client) GetStoragePools() (brain.StoragePools, error)

func (*Client) GetTail

func (c *Client) GetTail(idOrLabel string) (brain.Tail, error)

func (*Client) GetTails

func (c *Client) GetTails() (brain.Tails, error)

func (*Client) GetUser

func (c *Client) GetUser(name string) (brain.User, error)

func (*Client) GetVLAN

func (c *Client) GetVLAN(num int) (brain.VLAN, error)

func (*Client) GetVLANs

func (c *Client) GetVLANs() (brain.VLANs, error)

func (*Client) GetVirtualMachine

func (c *Client) GetVirtualMachine(name lib.VirtualMachineName) (vm brain.VirtualMachine, err error)

func (*Client) GrantPrivilege

func (c *Client) GrantPrivilege(priv brain.Privilege) (err error)

func (*Client) Impersonate

func (c *Client) Impersonate(user string) error

func (*Client) MigrateDisc

func (c *Client) MigrateDisc(disc int, newStoragePool string) error

func (*Client) MigrateVirtualMachine

func (c *Client) MigrateVirtualMachine(vmName lib.VirtualMachineName, newHead string) error

func (*Client) MoveVirtualMachine

func (c *Client) MoveVirtualMachine(oldName lib.VirtualMachineName, newName lib.VirtualMachineName) error

func (*Client) ParseAccountName

func (c *Client) ParseAccountName(name string, defaults ...string) string

func (*Client) ParseGroupName

func (c *Client) ParseGroupName(name string, defaults ...lib.GroupName) lib.GroupName

func (*Client) ParseVirtualMachineName

func (c *Client) ParseVirtualMachineName(name string, defaults ...lib.VirtualMachineName) (lib.VirtualMachineName, error)

func (*Client) ReadDefinitions

func (c *Client) ReadDefinitions() (lib.Definitions, error)

func (*Client) ReapVMs

func (c *Client) ReapVMs() error

func (*Client) RegisterNewAccount

func (c *Client) RegisterNewAccount(acc lib.Account) (lib.Account, error)

func (*Client) RegradeDisc

func (c *Client) RegradeDisc(disc int, newGrade string) error

func (*Client) ReifyDisc

func (c *Client) ReifyDisc(id int) error

func (*Client) ReimageVirtualMachine

func (c *Client) ReimageVirtualMachine(name lib.VirtualMachineName, image brain.ImageInstall) error

func (*Client) RejectVM

func (c *Client) RejectVM(name lib.VirtualMachineName, reason string) error

func (*Client) Request

func (c *Client) Request(auth bool, method string, location string, requestBody string) (req *http.Request, res *http.Response, err error)

func (*Client) RequestAndRead

func (c *Client) RequestAndRead(auth bool, method, path, requestBody string) (responseBody []byte, err error)

func (*Client) RequestAndUnmarshal

func (c *Client) RequestAndUnmarshal(auth bool, method, path, requestBody string, output interface{}) error

func (*Client) ResetVirtualMachine

func (c *Client) ResetVirtualMachine(name lib.VirtualMachineName) error

func (*Client) ResizeDisc

func (c *Client) ResizeDisc(name lib.VirtualMachineName, id string, size int) error

func (*Client) RestartVirtualMachine

func (c *Client) RestartVirtualMachine(name lib.VirtualMachineName) error

func (*Client) RestoreBackup

func (c *Client) RestoreBackup(server lib.VirtualMachineName, discLabelOrID string, backupLabelOrID string) (brain.Backup, error)

func (*Client) RevokePrivilege

func (c *Client) RevokePrivilege(priv brain.Privilege) (err error)

func (*Client) SetDebugLevel

func (c *Client) SetDebugLevel(level int)

func (*Client) SetDiscIopsLimit

func (c *Client) SetDiscIopsLimit(name lib.VirtualMachineName, id string, size int) error

func (*Client) SetVirtualMachineCDROM

func (c *Client) SetVirtualMachineCDROM(name lib.VirtualMachineName, url string) error

func (*Client) SetVirtualMachineCores

func (c *Client) SetVirtualMachineCores(name lib.VirtualMachineName, cores int) error

func (*Client) SetVirtualMachineHardwareProfile

func (c *Client) SetVirtualMachineHardwareProfile(name lib.VirtualMachineName, hwprofile string, locked ...bool) error

func (*Client) SetVirtualMachineHardwareProfileLock

func (c *Client) SetVirtualMachineHardwareProfileLock(name lib.VirtualMachineName, locked bool) error

func (*Client) SetVirtualMachineMemory

func (c *Client) SetVirtualMachineMemory(name lib.VirtualMachineName, memory int) error

func (*Client) ShutdownVirtualMachine

func (c *Client) ShutdownVirtualMachine(name lib.VirtualMachineName, stayoff bool) error

func (*Client) StartVirtualMachine

func (c *Client) StartVirtualMachine(name lib.VirtualMachineName) error

func (*Client) StopVirtualMachine

func (c *Client) StopVirtualMachine(name lib.VirtualMachineName) error

func (*Client) UndeleteVirtualMachine

func (c *Client) UndeleteVirtualMachine(name lib.VirtualMachineName) error

func (*Client) UpdateHead

func (c *Client) UpdateHead(idOrLabel string, options lib.UpdateHead) error

func (*Client) UpdateStoragePool

func (c *Client) UpdateStoragePool(idOrLabel string, options brain.StoragePool) error

func (*Client) UpdateTail

func (c *Client) UpdateTail(idOrLabel string, options lib.UpdateTail) error

func (*Client) UpdateVMMigration

func (c *Client) UpdateVMMigration(name lib.VirtualMachineName, speed *int64, downtime *int) error

type Config

type Config struct {
	mock.Mock
}

func (*Config) ConfigDir

func (c *Config) ConfigDir() string

func (*Config) EndpointName

func (c *Config) EndpointName() string

func (*Config) Force

func (c *Config) Force() bool

func (*Config) Get

func (c *Config) Get(name string) (string, error)

func (*Config) GetAll

func (c *Config) GetAll() (config.Vars, error)

func (*Config) GetBool

func (c *Config) GetBool(name string) (bool, error)

func (*Config) GetDebugLevel

func (c *Config) GetDebugLevel() int

func (*Config) GetGroup

func (c *Config) GetGroup() lib.GroupName

func (*Config) GetIgnoreErr

func (c *Config) GetIgnoreErr(name string) string

func (*Config) GetSessionValidity

func (c *Config) GetSessionValidity() (int, error)

func (*Config) GetV

func (c *Config) GetV(name string) (config.Var, error)

func (*Config) GetVirtualMachine

func (c *Config) GetVirtualMachine() lib.VirtualMachineName

func (*Config) ImportFlags

func (c *Config) ImportFlags(*flag.FlagSet) []string

func (*Config) PanelURL

func (c *Config) PanelURL() string

func (*Config) Set

func (c *Config) Set(name, value, source string)

func (*Config) SetPersistent

func (c *Config) SetPersistent(name, value, source string) error

func (*Config) Unset

func (c *Config) Unset(name string) error

type Prompter

type Prompter struct {
	mock.Mock
}

Prompter implements the cmd/bytemark/util.Prompter interface, as well as the cmd/bytemark/app/auth.passwordPrompter interface which allows for wrapping speakeasy.Ask calls

func (*Prompter) Ask

func (tp *Prompter) Ask(prompt string) (password string, err error)

func (*Prompter) Prompt

func (tp *Prompter) Prompt(prompt string) (response string)

type Request

type Request struct {
	T *testing.T

	StatusCode int
	// ResponseBody is the bytes that will be returned from Run/MarshalAndRun.
	// all JSON requests should use ResponseObject instead since ResponseBody
	// will not be unmarshalled into `out`
	ResponseBody []byte
	// ResponseObject is the object that will be assigned to `out` when
	// MarshalAndRun is called.
	// All non-JSON requests should use ResponseBody instead since
	// ResponseObject will not be marshalled and returned as responseBody.
	ResponseObject interface{}
	Err            error
	// contains filtered or unexported fields
}

func (*Request) AllowInsecure

func (r *Request) AllowInsecure()

func (*Request) AssertRequestBodyEqual

func (r *Request) AssertRequestBodyEqual(expected string)

func (*Request) AssertRequestObjectEqual

func (r *Request) AssertRequestObjectEqual(expected interface{})

func (*Request) GetURL

func (r *Request) GetURL() url.URL

func (*Request) MarshalAndRun

func (r *Request) MarshalAndRun(in interface{}, out interface{}) (statusCode int, responseBody []byte, err error)

func (*Request) Run

func (r *Request) Run(body io.Reader, out interface{}) (statusCode int, responseBody []byte, err error)

Jump to

Keyboard shortcuts

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