charmrepo.v1: gopkg.in/juju/charmrepo.v1/testing Index | Files

package testing

import "gopkg.in/juju/charmrepo.v1/testing"

Index

Package Files

charm.go mockstore.go suite.go testcharm.go

type Charm Uses

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

Charm holds a charm for testing. It does not have a representation on disk by default, but can be written to disk using Archive and its ExpandTo method. It implements the charm.Charm interface.

All methods on Charm may be called concurrently.

func NewCharm Uses

func NewCharm(c *gc.C, spec CharmSpec) *Charm

NewCharm returns a new charm

func (*Charm) Actions Uses

func (ch *Charm) Actions() *charm.Actions

Actions implements charm.Charm.Actions.

func (*Charm) Archive Uses

func (ch *Charm) Archive() *charm.CharmArchive

Archive returns a charm archive holding the charm.

func (*Charm) ArchiveBytes Uses

func (ch *Charm) ArchiveBytes() []byte

ArchiveBytes returns the contents of the charm archive holding the charm.

func (*Charm) Config Uses

func (ch *Charm) Config() *charm.Config

Config implements charm.Charm.Config.

func (*Charm) Meta Uses

func (ch *Charm) Meta() *charm.Meta

Meta implements charm.Charm.Meta.

func (*Charm) Metrics Uses

func (ch *Charm) Metrics() *charm.Metrics

Metrics implements charm.Charm.Metrics.

func (*Charm) Revision Uses

func (ch *Charm) Revision() int

Revision implements charm.Charm.Revision.

type CharmSpec Uses

type CharmSpec struct {
    // Meta holds the contents of metadata.yaml.
    Meta string

    // Config holds the contents of config.yaml.
    Config string

    // Actions holds the contents of actions.yaml.
    Actions string

    // Metrics holds the contents of metrics.yaml.
    Metrics string

    // Files holds any additional files that should be
    // added to the charm. If this is nil, a minimal set
    // of files will be added to ensure the charm is readable.
    Files []filetesting.Entry

    // Revision specifies the revision of the charm.
    Revision int
}

CharmSpec holds the specification for a charm. The fields hold data in YAML format.

type IsolatedMgoSuite Uses

type IsolatedMgoSuite struct {
    jujutesting.IsolationSuite
    jujutesting.MgoSuite
}

func (*IsolatedMgoSuite) SetUpSuite Uses

func (s *IsolatedMgoSuite) SetUpSuite(c *gc.C)

func (*IsolatedMgoSuite) SetUpTest Uses

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

func (*IsolatedMgoSuite) TearDownSuite Uses

func (s *IsolatedMgoSuite) TearDownSuite(c *gc.C)

func (*IsolatedMgoSuite) TearDownTest Uses

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

type MockStore Uses

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 Uses

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

NewMockStore creates a mock charm store containing the specified charms.

func (*MockStore) Address Uses

func (s *MockStore) Address() string

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

func (*MockStore) Close Uses

func (s *MockStore) Close()

Close closes the mock store's socket.

func (*MockStore) ServeHTTP Uses

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

ServeHTTP implements http.ServeHTTP

func (*MockStore) UpdateStoreRevision Uses

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

UpdateStoreRevision sets the revision of the specified charm to rev.

type Repo Uses

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

Repo represents a charm repository used for testing.

func NewRepo Uses

func NewRepo(path, defaultSeries string) *Repo

NewRepo returns a new testing charm repository rooted at the given path, relative to the package directory of the calling package, using defaultSeries as the default series.

func (*Repo) BundleArchive Uses

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

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

func (*Repo) BundleArchivePath Uses

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

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

func (*Repo) BundleDir Uses

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

BundleDir returns the actual charm.BundleDir named name.

func (*Repo) BundleDirPath Uses

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

BundleDirPath returns the path to a bundle directory with the given name in the default series

func (*Repo) CharmArchive Uses

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

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

func (*Repo) CharmArchivePath Uses

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

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

func (*Repo) CharmDir Uses

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

CharmDir returns the actual charm.CharmDir named name.

func (*Repo) CharmDirPath Uses

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) ClonedBundleDirPath Uses

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

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

func (*Repo) ClonedDir Uses

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 Uses

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 Uses

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 Uses

func (r *Repo) Path() string

func (*Repo) RenamedClonedDirPath Uses

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.

Package testing imports 22 packages (graph) and is imported by 1 packages. Updated 2016-07-18. Refresh now. Tools for package owners.