示例#1
0
func (r *restoreRootSuite) TestFindAllowedMethodWhenPreparing(c *gc.C) {
	root := apiserver.TestingAboutToRestoreRoot(nil)

	caller, err := root.FindMethod("Backups", 1, "Restore")

	c.Assert(err, jc.ErrorIsNil)
	c.Assert(caller, gc.NotNil)
}
示例#2
0
func (r *restoreRootSuite) TestFindDisallowedMethodWhenPreparing(c *gc.C) {
	root := apiserver.TestingAboutToRestoreRoot(nil)

	caller, err := root.FindMethod("Service", 3, "Deploy")

	c.Assert(err, gc.ErrorMatches, "juju restore is in progress - Juju functionality is limited to avoid data loss")
	c.Assert(caller, gc.IsNil)
}
示例#3
0
func (r *restoreRootSuite) TestFindAllowedMethodWhenPreparing(c *gc.C) {
	root := apiserver.TestingAboutToRestoreRoot(nil)

	// TODO(perrito666): Uncomment when Restore lands and delete
	// the following line.
	//caller, err := root.FindMethod("Backups", 0, "Restore")
	caller, err := root.FindMethod("Client", 0, "FullStatus")

	c.Assert(err, jc.ErrorIsNil)
	c.Assert(caller, gc.NotNil)
}
示例#4
0
func (r *restrictRestoreSuite) TestNotAllowed(c *gc.C) {
	root := apiserver.TestingAboutToRestoreRoot()
	caller, err := root.FindMethod("Application", 1, "Deploy")
	c.Assert(err, gc.ErrorMatches, "juju restore is in progress - functionality is limited to avoid data loss")
	c.Assert(caller, gc.IsNil)
}
示例#5
0
func (r *restrictRestoreSuite) TestAllowed(c *gc.C) {
	root := apiserver.TestingAboutToRestoreRoot()
	caller, err := root.FindMethod("Backups", 1, "Restore")
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(caller, gc.NotNil)
}