github.com/altoros/juju-vmware@v0.0.0-20150312064031-f19ae857ccca/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  	UserFriendlyDuration = userFriendlyDuration
    23  )
    24  
    25  // DisenableCommand is used for testing both Disable and Enable user commands.
    26  type DisenableCommand interface {
    27  	cmd.Command
    28  	Username() string
    29  }
    30  
    31  func (c *DisableCommand) Username() string {
    32  	return c.user
    33  }
    34  
    35  func (c *EnableCommand) Username() string {
    36  	return c.user
    37  }
    38  
    39  var (
    40  	_ DisenableCommand = (*DisableCommand)(nil)
    41  	_ DisenableCommand = (*EnableCommand)(nil)
    42  )
    43  
    44  // NewInfoCommand returns an InfoCommand with the api provided as specified.
    45  func NewInfoCommand(api UserInfoAPI) *InfoCommand {
    46  	return &InfoCommand{
    47  		InfoCommandBase: InfoCommandBase{
    48  			api: api,
    49  		},
    50  	}
    51  }
    52  
    53  // NewListCommand returns a ListCommand with the api provided as specified.
    54  func NewListCommand(api UserInfoAPI) *ListCommand {
    55  	return &ListCommand{
    56  		InfoCommandBase: InfoCommandBase{
    57  			api: api,
    58  		},
    59  	}
    60  }