~juju-qa/ubuntu/xenial/juju/xenial-2.0-beta3

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/apiserver/charmrevisionupdater/testing/suite.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
        "gopkg.in/juju/charmstore.v5-unstable"
16
16
 
17
17
        "github.com/juju/juju/apiserver/charmrevisionupdater"
 
18
        jujucharmstore "github.com/juju/juju/charmstore"
18
19
        jujutesting "github.com/juju/juju/juju/testing"
19
20
        "github.com/juju/juju/state"
20
21
        "github.com/juju/juju/testcharms"
44
45
                AuthUsername: "test-user",
45
46
                AuthPassword: "test-password",
46
47
        }
47
 
        handler, err := charmstore.NewServer(db, nil, "", params, charmstore.V4)
 
48
        handler, err := charmstore.NewServer(db, nil, "", params, charmstore.V5)
48
49
        c.Assert(err, jc.ErrorIsNil)
49
50
        s.Handler = handler
50
51
        s.Server = httptest.NewServer(handler)
66
67
        s.jcSuite.PatchValue(&charmrepo.CacheDir, c.MkDir())
67
68
        // Patch the charm repo initializer function: it is replaced with a charm
68
69
        // store repo pointing to the testing server.
69
 
        s.jcSuite.PatchValue(&charmrevisionupdater.NewCharmStore, func(p charmrepo.NewCharmStoreParams) *charmrepo.CharmStore {
70
 
                p.URL = s.Server.URL
71
 
                return charmrepo.NewCharmStore(p)
 
70
        s.jcSuite.PatchValue(&charmrevisionupdater.NewCharmStoreClientConfig, func() jujucharmstore.ClientConfig {
 
71
                var config jujucharmstore.ClientConfig
 
72
                config.URL = s.Server.URL
 
73
                return config
72
74
        })
73
75
        s.charms = make(map[string]*state.Charm)
74
76
}