~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/openstack/credentials_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:
104
104
                        "username":    "bob",
105
105
                        "password":    "dobbs",
106
106
                        "tenant-name": "gary",
 
107
                        "domain-name": "",
107
108
                },
108
109
        )
109
110
        expected.Label = `openstack region "west" project "gary" user "bob"`
123
124
 
124
125
        content := `
125
126
# Some secrets
126
 
OS_TENANT_NAME=gary
127
 
OS_USERNAME=bob
128
 
OS_PASSWORD=dobbs
 
127
export OS_TENANT_NAME=gary
 
128
EXPORT OS_USERNAME=bob
 
129
  export  OS_PASSWORD = dobbs
 
130
OS_REGION_NAME=region  
129
131
`[1:]
130
132
        novarc := filepath.Join(dir, ".novarc")
131
133
        err := ioutil.WriteFile(novarc, []byte(content), 0600)
132
134
 
133
135
        credentials, err := s.provider.DetectCredentials()
134
136
        c.Assert(err, jc.ErrorIsNil)
135
 
        c.Assert(credentials.DefaultRegion, gc.Equals, "")
 
137
        c.Assert(credentials.DefaultRegion, gc.Equals, "region")
136
138
        expected := cloud.NewCredential(
137
139
                cloud.UserPassAuthType, map[string]string{
138
140
                        "username":    "bob",
139
141
                        "password":    "dobbs",
140
142
                        "tenant-name": "gary",
 
143
                        "domain-name": "",
141
144
                },
142
145
        )
143
 
        expected.Label = `openstack region "<unspecified>" project "gary" user "bob"`
 
146
        expected.Label = `openstack region "region" project "gary" user "bob"`
144
147
        c.Assert(credentials.AuthCredentials["bob"], jc.DeepEquals, expected)
145
148
}