Index: state/apiserver/agent/agent_test.go |
=== modified file 'state/apiserver/agent/agent_test.go' |
--- state/apiserver/agent/agent_test.go 2013-07-30 07:37:14 +0000 |
+++ state/apiserver/agent/agent_test.go 2013-07-31 16:44:36 +0000 |
@@ -53,15 +53,24 @@ |
c.Assert(err, gc.IsNil) |
} |
-func (s *agentSuite) TestAgentFailsWithClientUser(c *gc.C) { |
+func (s *agentSuite) TestAgentFailsWithNonAgent(c *gc.C) { |
auth := s.authorizer |
- auth.Client = true |
+ auth.MachineAgent = false |
+ auth.UnitAgent = false |
api, err := agent.NewAPI(s.State, auth) |
c.Assert(err, gc.NotNil) |
c.Assert(api, gc.IsNil) |
c.Assert(err, gc.ErrorMatches, "permission denied") |
} |
+func (s *agentSuite) TestAgentSucceedsWithUnitAgent(c *gc.C) { |
+ auth := s.authorizer |
+ auth.MachineAgent = false |
+ auth.UnitAgent = true |
+ _, err := agent.NewAPI(s.State, auth) |
+ c.Assert(err, gc.IsNil) |
+} |
+ |
jameinel
2013/08/08 16:03:50
This is the "positive assertion" test I mention in
|
func (s *agentSuite) TestGetEntities(c *gc.C) { |
err := s.machine1.Destroy() |
c.Assert(err, gc.IsNil) |