~themue/juju-core/049-prepare-ec2

« back to all changes in this revision

Viewing changes to environs/config_test.go

  • Committer: Tarmac
  • Author(s): Roger Peppe, John Arbash Meinel
  • Date: 2013-10-02 12:38:13 UTC
  • mfrom: (1717.1.42 375-dummy-prepare-state-id)
  • Revision ID: tarmac-20131002123813-3tidl1lj00d3a29c
[r=rogpeppe] environs/dummy: add state-id

This makes the dummy provider more like the other
providers in that the Environ does not refer
directly to the bootstrapped state, but is looked
up when operations are performed on it.

This is also a test case for adding attributes at Prepare
time - many tests needed changing to correctly
deal with this.

https://codereview.appspot.com/14207046/

Show diffs side-by-side

added added

removed removed

Lines of Context:
214
214
        c.Assert(cfg.Name(), gc.Equals, "only")
215
215
}
216
216
 
217
 
func (suite) TestConfigRoundTrip(c *gc.C) {
218
 
        cfg, err := config.New(config.NoDefaults, dummySampleConfig())
219
 
        c.Assert(err, gc.IsNil)
220
 
        provider, err := environs.Provider(cfg.Type())
221
 
        c.Assert(err, gc.IsNil)
222
 
        cfg, err = provider.Validate(cfg, nil)
223
 
        c.Assert(err, gc.IsNil)
224
 
        env, err := environs.New(cfg)
225
 
        c.Assert(err, gc.IsNil)
226
 
        c.Assert(cfg.AllAttrs(), gc.DeepEquals, env.Config().AllAttrs())
227
 
}
228
 
 
229
217
func inMap(attrs testing.Attrs, attr string) bool {
230
218
        _, ok := attrs[attr]
231
219
        return ok