~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/cmd/juju/user/export_test.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
        "github.com/juju/juju/cmd/modelcmd"
 
10
        "github.com/juju/juju/juju"
 
11
        "github.com/juju/juju/jujuclient"
 
12
)
 
13
 
 
14
type AddCommand struct {
 
15
        *addCommand
 
16
}
 
17
 
 
18
type RemoveCommand struct {
 
19
        *removeCommand
 
20
}
 
21
 
 
22
type ChangePasswordCommand struct {
 
23
        *changePasswordCommand
 
24
}
 
25
 
 
26
type LoginCommand struct {
 
27
        *loginCommand
 
28
}
 
29
 
 
30
type LogoutCommand struct {
 
31
        *logoutCommand
 
32
}
 
33
 
 
34
type DisenableUserBase struct {
 
35
        *disenableUserBase
 
36
}
 
37
 
 
38
func NewAddCommandForTest(api AddUserAPI, store jujuclient.ClientStore, modelApi modelcmd.ModelAPI) (cmd.Command, *AddCommand) {
 
39
        c := &addCommand{api: api}
 
40
        c.SetClientStore(store)
 
41
        c.SetModelApi(modelApi)
 
42
        return modelcmd.WrapController(c), &AddCommand{c}
 
43
}
 
44
 
 
45
func NewRemoveCommandForTest(api RemoveUserAPI, store jujuclient.ClientStore) (cmd.Command, *RemoveCommand) {
 
46
        c := &removeCommand{api: api}
 
47
        c.SetClientStore(store)
 
48
        return modelcmd.WrapController(c), &RemoveCommand{c}
 
49
}
 
50
 
 
51
func NewShowUserCommandForTest(api UserInfoAPI, store jujuclient.ClientStore) cmd.Command {
 
52
        cmd := &infoCommand{infoCommandBase: infoCommandBase{api: api}}
 
53
        cmd.SetClientStore(store)
 
54
        return modelcmd.WrapController(cmd)
 
55
}
 
56
 
 
57
// NewChangePasswordCommand returns a ChangePasswordCommand with the api
 
58
// and writer provided as specified.
 
59
func NewChangePasswordCommandForTest(api ChangePasswordAPI, store jujuclient.ClientStore) (cmd.Command, *ChangePasswordCommand) {
 
60
        c := &changePasswordCommand{api: api}
 
61
        c.SetClientStore(store)
 
62
        return modelcmd.WrapController(c), &ChangePasswordCommand{c}
 
63
}
 
64
 
 
65
// NewLoginCommand returns a LoginCommand with the api
 
66
// and writer provided as specified.
 
67
func NewLoginCommandForTest(
 
68
        newLoginAPI func(juju.NewAPIConnectionParams) (LoginAPI, error),
 
69
        store jujuclient.ClientStore,
 
70
) (cmd.Command, *LoginCommand) {
 
71
        c := &loginCommand{newLoginAPI: newLoginAPI}
 
72
        c.SetClientStore(store)
 
73
        return modelcmd.WrapController(c), &LoginCommand{c}
 
74
}
 
75
 
 
76
// NewLogoutCommand returns a LogoutCommand with the api
 
77
// and writer provided as specified.
 
78
func NewLogoutCommandForTest(store jujuclient.ClientStore) (cmd.Command, *LogoutCommand) {
 
79
        c := &logoutCommand{}
 
80
        c.SetClientStore(store)
 
81
        return modelcmd.WrapController(c), &LogoutCommand{c}
 
82
}
 
83
 
 
84
// NewDisableCommand returns a DisableCommand with the api provided as
 
85
// specified.
 
86
func NewDisableCommandForTest(api disenableUserAPI, store jujuclient.ClientStore) (cmd.Command, *DisenableUserBase) {
 
87
        c := &disableCommand{disenableUserBase{api: api}}
 
88
        c.SetClientStore(store)
 
89
        return modelcmd.WrapController(c), &DisenableUserBase{&c.disenableUserBase}
 
90
}
 
91
 
 
92
// NewEnableCommand returns a EnableCommand with the api provided as
 
93
// specified.
 
94
func NewEnableCommandForTest(api disenableUserAPI, store jujuclient.ClientStore) (cmd.Command, *DisenableUserBase) {
 
95
        c := &enableCommand{disenableUserBase{api: api}}
 
96
        c.SetClientStore(store)
 
97
        return modelcmd.WrapController(c), &DisenableUserBase{&c.disenableUserBase}
 
98
}
 
99
 
 
100
// NewListCommand returns a ListCommand with the api provided as specified.
 
101
func NewListCommandForTest(api UserInfoAPI, store jujuclient.ClientStore) cmd.Command {
 
102
        c := &listCommand{infoCommandBase: infoCommandBase{api: api}}
 
103
        c.SetClientStore(store)
 
104
        return modelcmd.WrapController(c)
 
105
}