func (s *envManagerSuite) TestNewAPIRefusesNonClient(c *gc.C) { anAuthoriser := s.authoriser anAuthoriser.Tag = names.NewUnitTag("mysql/0") endPoint, err := environmentmanager.NewEnvironmentManagerAPI(s.State, s.resources, anAuthoriser) c.Assert(endPoint, gc.IsNil) c.Assert(err, gc.ErrorMatches, "permission denied") }
func (s *envManagerSuite) TestNewAPIAcceptsClient(c *gc.C) { anAuthoriser := s.authoriser anAuthoriser.Tag = names.NewUserTag("external@remote") endPoint, err := environmentmanager.NewEnvironmentManagerAPI(s.State, s.resources, anAuthoriser) c.Assert(err, jc.ErrorIsNil) c.Assert(endPoint, gc.NotNil) }
func (s *envManagerSuite) setAPIUser(c *gc.C, user names.UserTag) { s.authoriser.Tag = user envmanager, err := environmentmanager.NewEnvironmentManagerAPI(s.State, s.resources, s.authoriser) c.Assert(err, jc.ErrorIsNil) s.envmanager = envmanager }