github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/provider/gce/google/auth_test.go (about) 1 // Copyright 2014 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package google 5 6 import ( 7 "context" 8 9 jujuhttp "github.com/juju/http/v2" 10 jc "github.com/juju/testing/checkers" 11 gc "gopkg.in/check.v1" 12 ) 13 14 type authSuite struct { 15 BaseSuite 16 } 17 18 var _ = gc.Suite(&authSuite{}) 19 20 func (s *authSuite) TestNewComputeService(c *gc.C) { 21 _, err := newComputeService(context.TODO(), s.Credentials, jujuhttp.NewClient()) 22 c.Assert(err, jc.ErrorIsNil) 23 } 24 25 func (s *authSuite) TestCreateJWTConfig(c *gc.C) { 26 cfg, err := newJWTConfig(s.Credentials) 27 c.Assert(err, jc.ErrorIsNil) 28 c.Assert(cfg.Scopes, jc.DeepEquals, scopes) 29 } 30 31 func (s *authSuite) TestCreateJWTConfigWithNoJSONKey(c *gc.C) { 32 cfg, err := newJWTConfig(&Credentials{}) 33 c.Assert(err, jc.ErrorIsNil) 34 c.Assert(cfg.Scopes, jc.DeepEquals, scopes) 35 }