示例#1
0
文件: root_test.go 项目: imoapps/juju
func (s *errRootSuite) TestErrorRoot(c *gc.C) {
	origErr := fmt.Errorf("my custom error")
	errRoot := apiserver.NewErrRoot(origErr)
	st, err := errRoot.Admin("")
	c.Check(st, gc.IsNil)
	c.Check(err, gc.Equals, origErr)
}
示例#2
0
文件: root_test.go 项目: imoapps/juju
func (s *errRootSuite) TestErrorRootViaRPC(c *gc.C) {
	origErr := fmt.Errorf("my custom error")
	errRoot := apiserver.NewErrRoot(origErr)
	val := rpcreflect.ValueOf(reflect.ValueOf(errRoot))
	caller, err := val.FindMethod("Admin", 0, "Login")
	c.Assert(err, jc.ErrorIsNil)
	resp, err := caller.Call("", reflect.Value{})
	c.Check(err, gc.Equals, origErr)
	c.Check(resp.IsValid(), jc.IsFalse)
}