Exemple #1
0
func (s *ApplicationSuite) SetUpTest(c *gc.C) {
	s.IsolationSuite.SetUpTest(c)
	s.authorizer = apiservertesting.FakeAuthorizer{
		Tag: names.NewUserTag("admin"),
	}
	s.application = mockApplication{}
	s.charm = mockCharm{
		config: &charm.Config{
			Options: map[string]charm.Option{
				"stringOption": {Type: "string"},
				"intOption":    {Type: "int", Default: int(123)},
			},
		},
	}
	s.backend = mockBackend{
		application: &s.application,
		charm:       &s.charm,
	}
	s.blockChecker = mockBlockChecker{}
	api, err := application.NewAPI(
		&s.backend,
		s.authorizer,
		&s.blockChecker,
		func(application.Charm) *state.Charm {
			return &state.Charm{}
		},
	)
	c.Assert(err, jc.ErrorIsNil)
	s.api = api
}
Exemple #2
0
func (s *getSuite) SetUpTest(c *gc.C) {
	s.JujuConnSuite.SetUpTest(c)

	s.authorizer = apiservertesting.FakeAuthorizer{
		Tag: s.AdminUserTag(c),
	}
	var err error
	backend := application.NewStateBackend(s.State)
	blockChecker := common.NewBlockChecker(s.State)
	s.serviceAPI, err = application.NewAPI(
		backend, s.authorizer, blockChecker,
		application.CharmToStateCharm,
	)
	c.Assert(err, jc.ErrorIsNil)
}