~dave-cheney/pyjuju/go-environment-watcher

« back to all changes in this revision

Viewing changes to charm/meta_test.go

  • Committer: William Reade
  • Author(s): William Reade
  • Date: 2012-04-27 15:08:25 UTC
  • mfrom: (92.2.9 master)
  • Revision ID: fwereade@gmail.com-20120427150825-hmr8ug6y1ybu5fgm
Make test charm repository available from testing package

charm, state, and store were all testing against the same repo, and very
soon so will hook (so it can have a real unit to work with); seemed sensible
to make it hard for tests to accidentally write to charms they shouldn't,
and to avoid explicit use of "../charm/testrepo" in other packages.

Only notable change is file mode testing; it was actually only tested in one
place, and implicitly at that, so it's now explicitly tested in its own
test.

R=niemeyer, rog
CC=
https://codereview.appspot.com/5845051

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
        . "launchpad.net/gocheck"
8
8
        "launchpad.net/juju/go/charm"
9
9
        "launchpad.net/juju/go/schema"
 
10
        "launchpad.net/juju/go/testing"
10
11
        "os"
11
12
        "path/filepath"
12
13
)
13
14
 
14
15
func repoMeta(name string) io.Reader {
15
 
        file, err := os.Open(filepath.Join("testrepo", "series", name, "metadata.yaml"))
 
16
        charmDir := testing.Charms.DirPath(name)
 
17
        file, err := os.Open(filepath.Join(charmDir, "metadata.yaml"))
16
18
        if err != nil {
17
19
                panic(err)
18
20
        }