juju: github.com/wallyworld/juju/api/testing Index | Files

package testing

import "github.com/wallyworld/juju/api/testing"


Package Files

apiaddresser.go environwatcher.go fakeserver.go macaroonsuite.go resolver.go

func FakeAPIServer Uses

func FakeAPIServer(root interface{}) net.Conn

FakeAPIServer returns a net.Conn implementation that serves the RPC server defined by the given root object (see rpc.Conn.Serve).

func MacaroonEquals Uses

func MacaroonEquals(c *gc.C, m1, m2 *macaroon.Macaroon)

func MacaroonsEqual Uses

func MacaroonsEqual(c *gc.C, ms1, ms2 []macaroon.Slice) error

func NewMacaroon Uses

func NewMacaroon(id string) (*macaroon.Macaroon, error)

type APIAddresserFacade Uses

type APIAddresserFacade interface {
    APIAddresses() ([]string, error)
    APIHostPorts() ([]network.ProviderHostPorts, error)
    WatchAPIHostPorts() (watcher.NotifyWatcher, error)

type APIAddresserTests Uses

type APIAddresserTests struct {
    // contains filtered or unexported fields

func NewAPIAddresserTests Uses

func NewAPIAddresserTests(facade APIAddresserFacade, st *state.State, waitForModelWatchersIdle func(c *gc.C)) *APIAddresserTests

func (*APIAddresserTests) TestAPIAddresses Uses

func (s *APIAddresserTests) TestAPIAddresses(c *gc.C)

func (*APIAddresserTests) TestAPIHostPorts Uses

func (s *APIAddresserTests) TestAPIHostPorts(c *gc.C)

func (*APIAddresserTests) TestWatchAPIHostPorts Uses

func (s *APIAddresserTests) TestWatchAPIHostPorts(c *gc.C)

type ClearableCookieJar Uses

type ClearableCookieJar struct {
    // contains filtered or unexported fields

ClearableCookieJar implements a cookie jar that can be cleared of all cookies for testing purposes.

func NewClearableCookieJar Uses

func NewClearableCookieJar() *ClearableCookieJar

NewClearableCookieJar returns a new ClearableCookieJar.

func (*ClearableCookieJar) Clear Uses

func (jar *ClearableCookieJar) Clear()

Clear clears all the cookies in the jar. It is not OK to call Clear concurrently with the other methods.

func (*ClearableCookieJar) Cookies Uses

func (jar *ClearableCookieJar) Cookies(u *url.URL) []*http.Cookie

Cookies implements http.CookieJar.Cookies.

func (*ClearableCookieJar) SetCookies Uses

func (jar *ClearableCookieJar) SetCookies(u *url.URL, cookies []*http.Cookie)

Cookies implements http.CookieJar.SetCookies.

type IPAddrResolverMap Uses

type IPAddrResolverMap map[string][]string

IPAddrResolverMap implements IPAddrResolver by looking up the addresses in the map, which maps host names to IP addresses. The strings in the value slices should be valid IP addresses.

func (IPAddrResolverMap) LookupIPAddr Uses

func (r IPAddrResolverMap) LookupIPAddr(ctx context.Context, host string) ([]net.IPAddr, error)

type MacaroonSuite Uses

type MacaroonSuite struct {

    // DischargerLogin is called by the discharger when an
    // API macaroon is discharged. It should either return
    // the chosen username or an empty string, in which case
    // the discharge is denied.
    // If this is nil, func() {return ""} is implied.
    DischargerLogin func() string
    // contains filtered or unexported fields

MacaroonSuite wraps a JujuConnSuite with macaroon authentication enabled.

func (*MacaroonSuite) APIInfo Uses

func (s *MacaroonSuite) APIInfo(c *gc.C) *api.Info

APIInfo returns API connection info suitable for connecting to the API using macaroon authentication.

func (*MacaroonSuite) AddControllerUser Uses

func (s *MacaroonSuite) AddControllerUser(c *gc.C, username string, access permission.Access)

AddControllerUser is a convenience funcation that adds a controller user with the specified access.

func (*MacaroonSuite) AddModelUser Uses

func (s *MacaroonSuite) AddModelUser(c *gc.C, username string)

AddModelUser is a convenience function that adds an external user to the current model. It will panic if the user name is local.

func (*MacaroonSuite) DischargerLocation Uses

func (s *MacaroonSuite) DischargerLocation() string

DischargerLocation returns the URL of the third party caveat discharger.

func (*MacaroonSuite) OpenAPI Uses

func (s *MacaroonSuite) OpenAPI(c *gc.C, info *api.Info, jar http.CookieJar) api.Connection

OpenAPI opens a connection to the API using the given information. and empty DialOpts. If info is nil, s.APIInfo(c) is used. If jar is non-nil, it will be used as the store for the cookies created as a result of API interaction.

func (*MacaroonSuite) SetUpTest Uses

func (s *MacaroonSuite) SetUpTest(c *gc.C)

func (*MacaroonSuite) TearDownTest Uses

func (s *MacaroonSuite) TearDownTest(c *gc.C)

type ModelWatcherFacade Uses

type ModelWatcherFacade interface {
    WatchForModelConfigChanges() (watcher.NotifyWatcher, error)
    ModelConfig() (*config.Config, error)

type ModelWatcherTests Uses

type ModelWatcherTests struct {
    // contains filtered or unexported fields

func NewModelWatcherTests Uses

func NewModelWatcherTests(
    facade ModelWatcherFacade,
    st *state.State,
    m *state.Model,
) *ModelWatcherTests

func (*ModelWatcherTests) TestModelConfig Uses

func (s *ModelWatcherTests) TestModelConfig(c *gc.C)

func (*ModelWatcherTests) TestWatchForModelConfigChanges Uses

func (s *ModelWatcherTests) TestWatchForModelConfigChanges(c *gc.C)

Package testing imports 25 packages (graph). Updated 2020-08-06. Refresh now. Tools for package owners.