github.com/mhilton/juju-juju@v0.0.0-20150901100907-a94dd2c73455/cmd/juju/backups/restore_test.go (about) 1 // Copyright 2014 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package backups_test 5 6 import ( 7 //jc "github.com/juju/testing/checkers" 8 gc "gopkg.in/check.v1" 9 10 "github.com/juju/juju/cmd/juju/backups" 11 "github.com/juju/juju/testing" 12 ) 13 14 type restoreSuite struct { 15 BaseBackupsSuite 16 subcommand *backups.RestoreCommand 17 } 18 19 var _ = gc.Suite(&restoreSuite{}) 20 21 func (s *restoreSuite) SetUpTest(c *gc.C) { 22 s.BaseBackupsSuite.SetUpTest(c) 23 s.subcommand = &backups.RestoreCommand{} 24 } 25 26 func (s *restoreSuite) TestRestoreArgs(c *gc.C) { 27 _, err := testing.RunCommand(c, s.command, "restore") 28 c.Assert(err, gc.ErrorMatches, "you must specify either a file or a backup id.") 29 30 _, err = testing.RunCommand(c, s.command, "restore", "--id", "anid", "--file", "afile") 31 c.Assert(err, gc.ErrorMatches, "you must specify either a file or a backup id but not both.") 32 33 _, err = testing.RunCommand(c, s.command, "restore", "--id", "anid", "-b") 34 c.Assert(err, gc.ErrorMatches, "it is not possible to rebootstrap and restore from an id.") 35 }