github.com/axw/juju@v0.0.0-20161005053422-4bd6544d08d4/cmd/juju/space/export_test.go (about) 1 // Copyright 2015 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package space 5 6 import ( 7 "github.com/juju/cmd" 8 9 "github.com/juju/juju/cmd/modelcmd" 10 ) 11 12 func NewAddCommandForTest(api SpaceAPI) cmd.Command { 13 addCmd := &addCommand{ 14 SpaceCommandBase: SpaceCommandBase{api: api}, 15 } 16 return modelcmd.Wrap(addCmd) 17 } 18 19 type RemoveCommand struct { 20 *removeCommand 21 } 22 23 func (c *RemoveCommand) Name() string { 24 return c.name 25 } 26 27 func NewRemoveCommandForTest(api SpaceAPI) (cmd.Command, *RemoveCommand) { 28 removeCmd := &removeCommand{ 29 SpaceCommandBase: SpaceCommandBase{api: api}, 30 } 31 return modelcmd.Wrap(removeCmd), &RemoveCommand{removeCmd} 32 } 33 34 func NewUpdateCommandForTest(api SpaceAPI) cmd.Command { 35 updateCmd := &updateCommand{ 36 SpaceCommandBase: SpaceCommandBase{api: api}, 37 } 38 return modelcmd.Wrap(updateCmd) 39 } 40 41 type RenameCommand struct { 42 *renameCommand 43 } 44 45 func NewRenameCommandForTest(api SpaceAPI) (cmd.Command, *RenameCommand) { 46 renameCmd := &renameCommand{ 47 SpaceCommandBase: SpaceCommandBase{api: api}, 48 } 49 return modelcmd.Wrap(renameCmd), &RenameCommand{renameCmd} 50 } 51 52 type ListCommand struct { 53 *listCommand 54 } 55 56 func (c *ListCommand) ListFormat() string { 57 return c.out.Name() 58 } 59 60 func NewListCommandForTest(api SpaceAPI) (cmd.Command, *ListCommand) { 61 listCmd := &listCommand{ 62 SpaceCommandBase: SpaceCommandBase{api: api}, 63 } 64 return modelcmd.Wrap(listCmd), &ListCommand{listCmd} 65 }