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

« back to all changes in this revision

Viewing changes to store/branch_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/store"
 
10
        "launchpad.net/juju/go/testing"
10
11
        "os"
11
12
        "os/exec"
12
13
        "path/filepath"
24
25
        branch := bzrDir(tmpDir)
25
26
        branch.init()
26
27
 
27
 
        copyCharmDir(branch.path(), s.charm.Path)
 
28
        copyCharmDir(branch.path(), testing.Charms.Dir("dummy"))
28
29
        branch.add()
29
30
        branch.commit("Imported charm.")
30
31
        return branch
177
178
        return string(f[1])
178
179
}
179
180
 
180
 
func copyCharmDir(dst, src string) {
181
 
        dir, err := charm.ReadDir(src)
182
 
        if err != nil {
183
 
                panic(err)
184
 
        }
 
181
func copyCharmDir(dst string, dir *charm.Dir) {
185
182
        var b bytes.Buffer
186
 
        err = dir.BundleTo(&b)
 
183
        err := dir.BundleTo(&b)
187
184
        if err != nil {
188
185
                panic(err)
189
186
        }