Example #1
0
func (s *AuthSuite) TestAuthTokenInteractive(c *gc.C) {
	spec := environs.CloudSpec{
		Type:             "azure",
		Name:             "azure",
		Region:           "westus",
		Endpoint:         "https://api.azurestack.local",
		IdentityEndpoint: "https://graph.azurestack.local",
		StorageEndpoint:  "https://storage.azurestack.local",
		Credential:       fakeInteractiveCredential(),
	}
	senders := azuretesting.Senders{}
	_, err := azure.AuthToken(spec, &senders)
	c.Assert(err, gc.ErrorMatches, `auth-type "interactive" not supported`)
}
Example #2
0
func (s *AuthSuite) TestAuthTokenServicePrincipalSecret(c *gc.C) {
	spec := environs.CloudSpec{
		Type:             "azure",
		Name:             "azure",
		Region:           "westus",
		Endpoint:         "https://api.azurestack.local",
		IdentityEndpoint: "https://graph.azurestack.local",
		StorageEndpoint:  "https://storage.azurestack.local",
		Credential:       fakeServicePrincipalCredential(),
	}
	senders := azuretesting.Senders{
		discoverAuthSender(),
	}
	token, err := azure.AuthToken(spec, &senders)
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(token, gc.NotNil)
}