github.com/makyo/juju@v0.0.0-20160425123129-2608902037e9/cmd/juju/backups/show_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 "github.com/juju/cmd" 8 "github.com/juju/errors" 9 jc "github.com/juju/testing/checkers" 10 gc "gopkg.in/check.v1" 11 12 "github.com/juju/juju/cmd/juju/backups" 13 "github.com/juju/juju/testing" 14 ) 15 16 type showSuite struct { 17 BaseBackupsSuite 18 subcommand cmd.Command 19 } 20 21 var _ = gc.Suite(&showSuite{}) 22 23 func (s *showSuite) SetUpTest(c *gc.C) { 24 s.BaseBackupsSuite.SetUpTest(c) 25 s.subcommand = backups.NewShowCommandForTest() 26 } 27 28 func (s *showSuite) TestOkay(c *gc.C) { 29 s.setSuccess() 30 ctx, err := testing.RunCommand(c, s.subcommand, s.metaresult.ID) 31 c.Check(err, jc.ErrorIsNil) 32 33 out := MetaResultString 34 s.checkStd(c, ctx, out, "") 35 } 36 37 func (s *showSuite) TestError(c *gc.C) { 38 s.setFailure("failed!") 39 _, err := testing.RunCommand(c, s.subcommand, s.metaresult.ID) 40 c.Check(errors.Cause(err), gc.ErrorMatches, "failed!") 41 }