github.com/mwhudson/juju@v0.0.0-20160512215208-90ff01f3497f/provider/azure/credentials_test.go (about) 1 // Copyright 2016 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package azure_test 5 6 import ( 7 "github.com/juju/errors" 8 jc "github.com/juju/testing/checkers" 9 gc "gopkg.in/check.v1" 10 11 "github.com/juju/juju/environs" 12 envtesting "github.com/juju/juju/environs/testing" 13 "github.com/juju/juju/provider/azure" 14 "github.com/juju/juju/testing" 15 ) 16 17 type credentialsSuite struct { 18 testing.BaseSuite 19 provider environs.EnvironProvider 20 } 21 22 var _ = gc.Suite(&credentialsSuite{}) 23 24 func (s *credentialsSuite) SetUpTest(c *gc.C) { 25 s.BaseSuite.SetUpTest(c) 26 s.provider, _ = newProviders(c, azure.ProviderConfig{}) 27 } 28 29 func (s *credentialsSuite) TestCredentialSchemas(c *gc.C) { 30 envtesting.AssertProviderAuthTypes(c, s.provider, "userpass") 31 } 32 33 var sampleCredentialAttributes = map[string]string{ 34 "application-id": "application", 35 "application-password": "password", 36 "subscription-id": "subscription", 37 "tenant-id": "tenant", 38 } 39 40 func (s *credentialsSuite) TestUserPassCredentialsValid(c *gc.C) { 41 envtesting.AssertProviderCredentialsValid(c, s.provider, "userpass", map[string]string{ 42 "application-id": "application", 43 "application-password": "password", 44 "subscription-id": "subscription", 45 "tenant-id": "tenant", 46 }) 47 } 48 49 func (s *credentialsSuite) TestUserPassHiddenAttributes(c *gc.C) { 50 envtesting.AssertProviderCredentialsAttributesHidden(c, s.provider, "userpass", "application-password") 51 } 52 53 func (s *credentialsSuite) TestDetectCredentials(c *gc.C) { 54 _, err := s.provider.DetectCredentials() 55 c.Assert(err, jc.Satisfies, errors.IsNotFound) 56 }