testing

package
v2.0.0-...-39b1fc1 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2014 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Charms = &Repo{}

Charms represents the specific charm repository stored in this package and used by the Juju unit tests. The series name is "quantal".

Functions

This section is empty.

Types

type MockCharmStore

type MockCharmStore struct {
	AuthAttrs     string
	TestMode      bool
	DefaultSeries string
	// contains filtered or unexported fields
}

MockCharmStore implements charm.Repository and is used to isolate tests that would otherwise need to hit the real charm store.

func NewMockCharmStore

func NewMockCharmStore() *MockCharmStore

func (*MockCharmStore) Get

func (s *MockCharmStore) Get(charmURL *charm.URL) (charm.Charm, error)

Get implements charm.Repository.Get.

func (*MockCharmStore) Latest

func (s *MockCharmStore) Latest(charmURLs ...*charm.URL) ([]charm.CharmRevision, error)

Latest implements charm.Repository.Latest.

func (*MockCharmStore) Resolve

func (s *MockCharmStore) Resolve(ref charm.Reference) (*charm.URL, error)

func (*MockCharmStore) SetCharm

func (s *MockCharmStore) SetCharm(charmURL *charm.URL, archive *charm.CharmArchive) error

SetCharm adds and removes charms in s. The affected charm is identified by charmURL, which must be revisioned. If archive is nil, the charm will be removed; otherwise, it will be stored. It is an error to store a archive under a charmURL that does not share its name and revision.

func (*MockCharmStore) WithAuthAttrs

func (s *MockCharmStore) WithAuthAttrs(auth string) charm.Repository

func (*MockCharmStore) WithDefaultSeries

func (s *MockCharmStore) WithDefaultSeries(series string) charm.Repository

func (*MockCharmStore) WithTestMode

func (s *MockCharmStore) WithTestMode(testMode bool) charm.Repository

type MockStore

type MockStore struct {
	Downloads               []*charm.URL
	DownloadsNoStats        []*charm.URL
	Authorizations          []string
	Metadata                []string
	InfoRequestCount        int
	InfoRequestCountNoStats int
	DefaultSeries           string
	// contains filtered or unexported fields
}

MockStore provides a mock charm store implementation useful when testing.

func NewMockStore

func NewMockStore(c *gc.C, charms map[string]int) *MockStore

NewMockStore creates a mock charm store containing the specified charms.

func (*MockStore) Address

func (s *MockStore) Address() string

Address returns the URL used to make requests to the mock store.

func (*MockStore) Close

func (s *MockStore) Close()

Close closes the mock store's socket.

func (*MockStore) ServeHTTP

func (s *MockStore) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.ServeHTTP

func (*MockStore) UpdateStoreRevision

func (s *MockStore) UpdateStoreRevision(ch string, rev int)

UpdateStoreRevision sets the revision of the specified charm to rev.

type Repo

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

Repo represents a charm repository used for testing.

func (*Repo) CharmArchive

func (r *Repo) CharmArchive(dst, name string) *charm.CharmArchive

Archive returns an actual charm.Archive created from a new charm archive file created from the charm directory named name, in the directory dst.

func (*Repo) CharmArchivePath

func (r *Repo) CharmArchivePath(dst, name string) string

CharmArchivePath returns the path to a new charm archive file created from the charm directory named name, in the directory dst.

func (*Repo) CharmDir

func (r *Repo) CharmDir(name string) *charm.CharmDir

CharmDir returns the actual charm.CharmDir named name.

func (*Repo) CharmDirPath

func (r *Repo) CharmDirPath(name string) string

CharmDirPath returns the path to a charm directory with the given name in the default series

func (*Repo) ClonedDir

func (r *Repo) ClonedDir(dst, name string) *charm.CharmDir

ClonedDir returns an actual charm.CharmDir based on a new copy of the charm directory named name, in the directory dst.

func (*Repo) ClonedDirPath

func (r *Repo) ClonedDirPath(dst, name string) string

ClonedDirPath returns the path to a new copy of the default charm directory named name.

func (*Repo) ClonedURL

func (r *Repo) ClonedURL(dst, series, name string) *charm.URL

ClonedURL makes a copy of the charm directory. It will create a directory with the series name if it does not exist, and then clone the charm named name into that directory. The return value is a URL pointing at the local charm.

func (*Repo) Path

func (r *Repo) Path() string

func (*Repo) RenamedClonedDirPath

func (r *Repo) RenamedClonedDirPath(dst, name, newName string) string

RenamedClonedDirPath returns the path to a new copy of the default charm directory named name, renamed to newName.

Jump to

Keyboard shortcuts

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