This section is empty.


This section is empty.


func FakeAPIServer

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

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

func MacaroonsEqual

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

func NewMacaroon

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


type APIAddresserFacade

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

type APIAddresserTests

type APIAddresserTests struct {
	// contains filtered or unexported fields

func NewAPIAddresserTests

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

func (*APIAddresserTests) TestAPIAddresses

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

func (*APIAddresserTests) TestAPIHostPorts

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

func (*APIAddresserTests) TestWatchAPIHostPorts

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

type ClearableCookieJar

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

func NewClearableCookieJar() *ClearableCookieJar

NewClearableCookieJar returns a new ClearableCookieJar.

func (*ClearableCookieJar) Clear

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

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

Cookies implements http.CookieJar.Cookies.

func (*ClearableCookieJar) SetCookies

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

Cookies implements http.CookieJar.SetCookies.

type IPAddrResolverMap

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

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

type MacaroonSuite

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

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

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

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

func (s *MacaroonSuite) DischargerLocation() string

DischargerLocation returns the URL of the third party caveat discharger.

func (*MacaroonSuite) OpenAPI

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

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

func (*MacaroonSuite) TearDownTest

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

type ModelWatcherFacade

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

type ModelWatcherTests

type ModelWatcherTests struct {
	// contains filtered or unexported fields

func NewModelWatcherTests

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

func (*ModelWatcherTests) TestModelConfig

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

func (*ModelWatcherTests) TestWatchForModelConfigChanges

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