Beispiel #1
0
func (s *uniterV1Suite) SetUpTest(c *gc.C) {
	s.uniterBaseSuite.setUpTest(c)

	uniterAPIV1, err := uniter.NewUniterAPIV1(
		s.State,
		s.resources,
		s.authorizer,
	)
	c.Assert(err, jc.ErrorIsNil)
	s.uniter = uniterAPIV1

	meteredAuthorizer := apiservertesting.FakeAuthorizer{
		Tag: s.meteredUnit.Tag(),
	}
	s.meteredUniter, err = uniter.NewUniterAPIV1(
		s.State,
		s.resources,
		meteredAuthorizer,
	)
	c.Assert(err, jc.ErrorIsNil)

	s.EnvironWatcherTest = commontesting.NewEnvironWatcherTest(
		s.uniter,
		s.State,
		s.resources,
		commontesting.NoSecrets,
	)
}
Beispiel #2
0
func (s *uniterV1Suite) TestUniterFailsWithNonUnitAgentUser(c *gc.C) {
	factory := func(st *state.State, res *common.Resources, auth common.Authorizer) error {
		_, err := uniter.NewUniterAPIV1(st, res, auth)
		return err
	}
	s.testUniterFailsWithNonUnitAgentUser(c, factory)
}
Beispiel #3
0
func (s *uniterV1Suite) TestActionsWrongUnit(c *gc.C) {
	factory := func(
		st *state.State,
		resources *common.Resources,
		authorizer common.Authorizer,
	) (actions, error) {
		return uniter.NewUniterAPIV1(st, resources, authorizer)
	}
	s.testActionsWrongUnit(c, factory)
}
Beispiel #4
0
func (s *uniterV1Suite) TestGetPrincipal(c *gc.C) {
	factory := func(
		st *state.State,
		resources *common.Resources,
		authorizer common.Authorizer,
	) (getPrincipal, error) {
		return uniter.NewUniterAPIV1(st, resources, authorizer)
	}
	s.testGetPrincipal(c, s.uniter, factory)
}