github.com/Pankov404/juju@v0.0.0-20150703034450-be266991dceb/cmd/juju/user/export_test.go (about) 1 // Copyright 2014 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package user 5 6 import ( 7 "github.com/juju/cmd" 8 ) 9 10 var ( 11 ReadPassword = &readPassword 12 // add 13 GetAddUserAPI = &getAddUserAPI 14 GetShareEnvAPI = &getShareEnvAPI 15 // change password 16 GetChangePasswordAPI = &getChangePasswordAPI 17 GetEnvironInfoWriter = &getEnvironInfoWriter 18 GetConnectionCredentials = &getConnectionCredentials 19 // disable and enable 20 GetDisableUserAPI = &getDisableUserAPI 21 ) 22 23 // DisenableCommand is used for testing both Disable and Enable user commands. 24 type DisenableCommand interface { 25 cmd.Command 26 Username() string 27 } 28 29 func (c *DisableCommand) Username() string { 30 return c.user 31 } 32 33 func (c *EnableCommand) Username() string { 34 return c.user 35 } 36 37 var ( 38 _ DisenableCommand = (*DisableCommand)(nil) 39 _ DisenableCommand = (*EnableCommand)(nil) 40 ) 41 42 // NewInfoCommand returns an InfoCommand with the api provided as specified. 43 func NewInfoCommand(api UserInfoAPI) *InfoCommand { 44 return &InfoCommand{ 45 InfoCommandBase: InfoCommandBase{ 46 api: api, 47 }, 48 } 49 } 50 51 // NewListCommand returns a ListCommand with the api provided as specified. 52 func NewListCommand(api UserInfoAPI) *ListCommand { 53 return &ListCommand{ 54 InfoCommandBase: InfoCommandBase{ 55 api: api, 56 }, 57 } 58 }