func (s *rsyslogSuite) SetUpTest(c *gc.C) { s.JujuConnSuite.SetUpTest(c) s.authorizer = apiservertesting.FakeAuthorizer{ LoggedIn: true, EnvironManager: true, MachineAgent: true, } s.resources = common.NewResources() api, err := rsyslog.NewRsyslogAPI(s.State, s.resources, s.authorizer) c.Assert(err, gc.IsNil) s.EnvironWatcherTest = commontesting.NewEnvironWatcherTest( api, s.State, s.resources, commontesting.NoSecrets) }
func (s *firewallerSuite) SetUpTest(c *gc.C) { s.JujuConnSuite.SetUpTest(c) // Reset previous machines and units (if any) and create 3 // machines for the tests. s.machines = nil s.units = nil // Note that the specific machine ids allocated are assumed // to be numerically consecutive from zero. for i := 0; i <= 2; i++ { machine, err := s.State.AddMachine("quantal", state.JobHostUnits) c.Check(err, gc.IsNil) s.machines = append(s.machines, machine) } // Create a service and three units for these machines. s.charm = s.AddTestingCharm(c, "wordpress") s.service = s.AddTestingService(c, "wordpress", s.charm) // Add the rest of the units and assign them. for i := 0; i <= 2; i++ { unit, err := s.service.AddUnit() c.Check(err, gc.IsNil) err = unit.AssignToMachine(s.machines[i]) c.Check(err, gc.IsNil) s.units = append(s.units, unit) } // Create a FakeAuthorizer so we can check permissions, // set up assuming we logged in as the environment manager. s.authorizer = apiservertesting.FakeAuthorizer{ LoggedIn: true, EnvironManager: true, } // Create the resource registry separately to track invocations to // Register. s.resources = common.NewResources() // Create a firewaller API for the machine. firewallerAPI, err := firewaller.NewFirewallerAPI( s.State, s.resources, s.authorizer, ) c.Assert(err, gc.IsNil) s.firewaller = firewallerAPI s.EnvironWatcherTest = commontesting.NewEnvironWatcherTest(s.firewaller, s.State, s.resources, commontesting.HasSecrets) }
func (s *environmentSuite) SetUpTest(c *gc.C) { s.JujuConnSuite.SetUpTest(c) var err error s.machine0, err = s.State.AddMachine("quantal", state.JobHostUnits, state.JobManageEnviron) c.Assert(err, gc.IsNil) s.authorizer = apiservertesting.FakeAuthorizer{ Tag: s.machine0.Tag(), LoggedIn: true, MachineAgent: true, Entity: s.machine0, } s.resources = common.NewResources() s.api, err = environment.NewEnvironmentAPI( s.State, s.resources, s.authorizer, ) c.Assert(err, gc.IsNil) s.EnvironWatcherTest = commontesting.NewEnvironWatcherTest( s.api, s.State, s.resources, commontesting.NoSecrets) }