github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/apiserver/facades/controller/caasmodelconfigmanager/facade_test.go (about) 1 // Copyright 2021 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package caasmodelconfigmanager_test 5 6 import ( 7 "github.com/juju/testing" 8 "go.uber.org/mock/gomock" 9 gc "gopkg.in/check.v1" 10 11 "github.com/juju/juju/apiserver/facades/controller/caasmodelconfigmanager" 12 "github.com/juju/juju/apiserver/facades/controller/caasmodelconfigmanager/mocks" 13 ) 14 15 var _ = gc.Suite(&caasmodelconfigmanagerSuite{}) 16 17 type caasmodelconfigmanagerSuite struct { 18 testing.IsolationSuite 19 } 20 21 func (s *caasmodelconfigmanagerSuite) TestAuth(c *gc.C) { 22 ctrl := gomock.NewController(c) 23 defer ctrl.Finish() 24 25 ctx := mocks.NewMockContext(ctrl) 26 authorizer := mocks.NewMockAuthorizer(ctrl) 27 28 gomock.InOrder( 29 ctx.EXPECT().Auth().Return(authorizer), 30 authorizer.EXPECT().AuthController().Return(false), 31 ) 32 33 _, err := caasmodelconfigmanager.NewFacade(ctx) 34 c.Assert(err, gc.ErrorMatches, `permission denied`) 35 }