github.com/makyo/juju@v0.0.0-20160425123129-2608902037e9/cmd/juju/action/export_test.go (about) 1 // Copyright 2014-2015 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package action 5 6 import ( 7 "github.com/juju/cmd" 8 "github.com/juju/names" 9 10 "github.com/juju/juju/apiserver/params" 11 "github.com/juju/juju/cmd/modelcmd" 12 "github.com/juju/juju/jujuclient" 13 ) 14 15 var ( 16 NewActionAPIClient = &newAPIClient 17 AddValueToMap = addValueToMap 18 ) 19 20 type ShowOutputCommand struct { 21 *showOutputCommand 22 } 23 24 type StatusCommand struct { 25 *statusCommand 26 } 27 28 type RunCommand struct { 29 *runCommand 30 } 31 32 func (c *RunCommand) UnitTag() names.UnitTag { 33 return c.unitTag 34 } 35 36 func (c *RunCommand) ActionName() string { 37 return c.actionName 38 } 39 40 func (c *RunCommand) ParseStrings() bool { 41 return c.parseStrings 42 } 43 44 func (c *RunCommand) ParamsYAML() cmd.FileVar { 45 return c.paramsYAML 46 } 47 48 func (c *RunCommand) Args() [][]string { 49 return c.args 50 } 51 52 type ListCommand struct { 53 *listCommand 54 } 55 56 func (c *ListCommand) ServiceTag() names.ServiceTag { 57 return c.serviceTag 58 } 59 60 func (c *ListCommand) FullSchema() bool { 61 return c.fullSchema 62 } 63 64 func NewShowOutputCommandForTest(store jujuclient.ClientStore) (cmd.Command, *ShowOutputCommand) { 65 c := &showOutputCommand{} 66 c.SetClientStore(store) 67 return modelcmd.Wrap(c), &ShowOutputCommand{c} 68 } 69 70 func NewStatusCommandForTest(store jujuclient.ClientStore) (cmd.Command, *StatusCommand) { 71 c := &statusCommand{} 72 c.SetClientStore(store) 73 return modelcmd.Wrap(c), &StatusCommand{c} 74 } 75 76 func NewListCommandForTest(store jujuclient.ClientStore) (cmd.Command, *ListCommand) { 77 c := &listCommand{} 78 c.SetClientStore(store) 79 return modelcmd.Wrap(c, modelcmd.ModelSkipDefault), &ListCommand{c} 80 } 81 82 func NewRunCommandForTest(store jujuclient.ClientStore) (cmd.Command, *RunCommand) { 83 c := &runCommand{} 84 c.SetClientStore(store) 85 return modelcmd.Wrap(c, modelcmd.ModelSkipDefault), &RunCommand{c} 86 } 87 88 func ActionResultsToMap(results []params.ActionResult) map[string]interface{} { 89 return resultsToMap(results) 90 }