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

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/provider/azure/environprovider_test.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
 
16
16
        "github.com/juju/juju/cloud"
17
17
        "github.com/juju/juju/environs"
18
 
        envtesting "github.com/juju/juju/environs/testing"
19
18
        "github.com/juju/juju/provider/azure"
20
19
        "github.com/juju/juju/provider/azure/internal/azuretesting"
21
20
        "github.com/juju/juju/storage"
40
39
        s.sender = nil
41
40
}
42
41
 
43
 
func (s *environProviderSuite) TestPrepareForBootstrapWithInternalConfig(c *gc.C) {
44
 
        s.testPrepareForBootstrapWithInternalConfig(c, "controller-resource-group")
45
 
        s.testPrepareForBootstrapWithInternalConfig(c, "storage-account")
 
42
func (s *environProviderSuite) TestBootstrapConfigWithInternalConfig(c *gc.C) {
 
43
        s.testBootstrapConfigWithInternalConfig(c, "controller-resource-group")
 
44
        s.testBootstrapConfigWithInternalConfig(c, "storage-account")
46
45
}
47
46
 
48
 
func (s *environProviderSuite) testPrepareForBootstrapWithInternalConfig(c *gc.C, key string) {
49
 
        ctx := envtesting.BootstrapContext(c)
 
47
func (s *environProviderSuite) testBootstrapConfigWithInternalConfig(c *gc.C, key string) {
50
48
        cfg := makeTestModelConfig(c, testing.Attrs{key: "whatever"})
51
49
        s.sender = azuretesting.Senders{tokenRefreshSender()}
52
 
        _, err := s.provider.PrepareForBootstrap(ctx, environs.PrepareForBootstrapParams{
 
50
        _, err := s.provider.BootstrapConfig(environs.BootstrapConfigParams{
53
51
                Config:      cfg,
54
52
                Credentials: fakeUserPassCredential(),
55
53
        })
68
66
        )
69
67
}
70
68
 
71
 
func (s *environProviderSuite) TestPrepareForBootstrap(c *gc.C) {
72
 
        ctx := envtesting.BootstrapContext(c)
 
69
func (s *environProviderSuite) TestBootstrapConfig(c *gc.C) {
73
70
        cfg := makeTestModelConfig(c)
74
71
        cfg, err := cfg.Remove([]string{"controller-resource-group"})
75
72
        c.Assert(err, jc.ErrorIsNil)
76
73
 
77
74
        s.sender = azuretesting.Senders{tokenRefreshSender()}
78
 
        env, err := s.provider.PrepareForBootstrap(ctx, environs.PrepareForBootstrapParams{
 
75
        cfg, err = s.provider.BootstrapConfig(environs.BootstrapConfigParams{
79
76
                Config:               cfg,
80
77
                CloudRegion:          "westus",
81
78
                CloudEndpoint:        "https://api.azurestack.local",
83
80
                Credentials:          fakeUserPassCredential(),
84
81
        })
85
82
        c.Check(err, jc.ErrorIsNil)
86
 
        c.Check(env, gc.NotNil)
 
83
        c.Check(cfg, gc.NotNil)
87
84
 
88
 
        cfg = env.Config()
89
85
        c.Assert(
90
86
                cfg.UnknownAttrs()["controller-resource-group"],
91
87
                gc.Equals,