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

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/state/initialize_test.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
import (
7
7
        gitjujutesting "github.com/juju/testing"
8
8
        jc "github.com/juju/testing/checkers"
 
9
        "github.com/juju/utils/clock"
9
10
        gc "gopkg.in/check.v1"
10
11
        "gopkg.in/juju/names.v2"
11
12
 
93
94
        controllerCfg := testing.FakeControllerConfig()
94
95
 
95
96
        st, err := state.Initialize(state.InitializeParams{
 
97
                Clock:            clock.WallClock,
96
98
                ControllerConfig: controllerCfg,
97
99
                ControllerModelArgs: state.ModelArgs{
98
100
                        Owner:                   owner,
172
174
        c.Assert(credentialTag, gc.Equals, userPassCredentialTag)
173
175
        cloudCredentials, err := s.State.CloudCredentials(model.Owner(), "dummy")
174
176
        c.Assert(err, jc.ErrorIsNil)
175
 
        c.Assert(cloudCredentials, jc.DeepEquals, cloudCredentialsIn)
 
177
        expectedCred := make(map[string]cloud.Credential, len(cloudCredentialsIn))
 
178
        for tag, cred := range cloudCredentialsIn {
 
179
                expectedCred[tag.Canonical()] = cred
 
180
        }
 
181
        c.Assert(cloudCredentials, jc.DeepEquals, expectedCred)
176
182
}
177
183
 
178
184
func (s *InitializeSuite) TestInitializeWithInvalidCredentialType(c *gc.C) {
181
187
        controllerCfg := testing.FakeControllerConfig()
182
188
        credentialTag := names.NewCloudCredentialTag("dummy/" + owner.Canonical() + "/borken")
183
189
        _, err := state.Initialize(state.InitializeParams{
 
190
                Clock:            clock.WallClock,
184
191
                ControllerConfig: controllerCfg,
185
192
                ControllerModelArgs: state.ModelArgs{
186
193
                        CloudName:               "dummy",
217
224
        controllerCfg := testing.FakeControllerConfig()
218
225
 
219
226
        st, err := state.Initialize(state.InitializeParams{
 
227
                Clock:            clock.WallClock,
220
228
                ControllerConfig: controllerCfg,
221
229
                ControllerModelArgs: state.ModelArgs{
222
230
                        CloudName:               "dummy",
268
276
        controllerCfg := testing.FakeControllerConfig()
269
277
 
270
278
        args := state.InitializeParams{
 
279
                Clock:            clock.WallClock,
271
280
                ControllerConfig: controllerCfg,
272
281
                ControllerModelArgs: state.ModelArgs{
273
282
                        CloudName:               "dummy",
325
334
        controllerCfg := testing.FakeControllerConfig()
326
335
 
327
336
        args := state.InitializeParams{
 
337
                Clock:            clock.WallClock,
328
338
                ControllerConfig: controllerCfg,
329
339
                ControllerModelArgs: state.ModelArgs{
330
340
                        CloudName:               "dummy",
375
385
        modelCfg := testing.ModelConfig(c)
376
386
        controllerCfg := testing.FakeControllerConfig()
377
387
        args := state.InitializeParams{
 
388
                Clock:            clock.WallClock,
378
389
                ControllerConfig: controllerCfg,
379
390
                ControllerModelArgs: state.ModelArgs{
380
391
                        CloudName:               "dummy",
416
427
        controllerCfg := testing.FakeControllerConfig()
417
428
 
418
429
        st, err := state.Initialize(state.InitializeParams{
 
430
                Clock:            clock.WallClock,
419
431
                ControllerConfig: controllerCfg,
420
432
                ControllerModelArgs: state.ModelArgs{
421
433
                        CloudName:               "dummy",
473
485
        controllerCfg := testing.FakeControllerConfig()
474
486
 
475
487
        st, err := state.Initialize(state.InitializeParams{
 
488
                Clock:            clock.WallClock,
476
489
                ControllerConfig: controllerCfg,
477
490
                ControllerModelArgs: state.ModelArgs{
478
491
                        CloudName:               "dummy",
526
539
        controllerCfg := testing.FakeControllerConfig()
527
540
 
528
541
        st, err := state.Initialize(state.InitializeParams{
 
542
                Clock:            clock.WallClock,
529
543
                ControllerConfig: controllerCfg,
530
544
                ControllerModelArgs: state.ModelArgs{
531
545
                        CloudName:               "dummy",