github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/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 "gopkg.in/juju/names.v2" 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 CancelCommand struct { 29 *cancelCommand 30 } 31 32 type RunCommand struct { 33 *runCommand 34 } 35 36 func (c *RunCommand) UnitNames() []string { 37 return c.unitReceivers 38 } 39 40 func (c *RunCommand) ActionName() string { 41 return c.actionName 42 } 43 44 func (c *RunCommand) ParseStrings() bool { 45 return c.parseStrings 46 } 47 48 func (c *RunCommand) ParamsYAML() cmd.FileVar { 49 return c.paramsYAML 50 } 51 52 func (c *RunCommand) Args() [][]string { 53 return c.args 54 } 55 56 type ListCommand struct { 57 *listCommand 58 } 59 60 func (c *ListCommand) ApplicationTag() names.ApplicationTag { 61 return c.applicationTag 62 } 63 64 func (c *ListCommand) FullSchema() bool { 65 return c.fullSchema 66 } 67 68 func NewShowOutputCommandForTest(store jujuclient.ClientStore) (cmd.Command, *ShowOutputCommand) { 69 c := &showOutputCommand{} 70 c.SetClientStore(store) 71 return modelcmd.Wrap(c), &ShowOutputCommand{c} 72 } 73 74 func NewStatusCommandForTest(store jujuclient.ClientStore) (cmd.Command, *StatusCommand) { 75 c := &statusCommand{} 76 c.SetClientStore(store) 77 return modelcmd.Wrap(c), &StatusCommand{c} 78 } 79 80 func NewCancelCommandForTest(store jujuclient.ClientStore) (cmd.Command, *CancelCommand) { 81 c := &cancelCommand{} 82 c.SetClientStore(store) 83 return modelcmd.Wrap(c), &CancelCommand{c} 84 } 85 86 func NewListCommandForTest(store jujuclient.ClientStore) (cmd.Command, *ListCommand) { 87 c := &listCommand{} 88 c.SetClientStore(store) 89 return modelcmd.Wrap(c, modelcmd.WrapSkipDefaultModel), &ListCommand{c} 90 } 91 92 func NewRunCommandForTest(store jujuclient.ClientStore) (cmd.Command, *RunCommand) { 93 c := &runCommand{} 94 c.SetClientStore(store) 95 return modelcmd.Wrap(c, modelcmd.WrapSkipDefaultModel), &RunCommand{c} 96 } 97 98 func ActionResultsToMap(results []params.ActionResult) map[string]interface{} { 99 return resultsToMap(results) 100 }