testing

package
v0.0.0-...-566e3ca Latest Latest
Warning

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

Go to latest
Published: Sep 18, 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, bundle *charm.Bundle) error

SetCharm adds and removes charms in s. The affected charm is identified by charmURL, which must be revisioned. If bundle is nil, the charm will be removed; otherwise, it will be stored. It is an error to store a bundle 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) Bundle

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

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

func (*Repo) BundlePath

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

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

func (*Repo) ClonedDir

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

ClonedDir returns an actual charm.Dir 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) Dir

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

Dir returns the actual charm.Dir named name.

func (*Repo) DirPath

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

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

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