~juju-qa/ubuntu/xenial/juju/2.0-rc2

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/cmd/juju/application/fakeapplication_test.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 
14
14
// fakeServiceAPI is the fake application API for testing the application
15
15
// update command.
16
 
type fakeServiceAPI struct {
17
 
        serviceName string
18
 
        charmName   string
19
 
        values      map[string]interface{}
20
 
        config      string
21
 
        err         error
 
16
type fakeApplicationAPI struct {
 
17
        name      string
 
18
        charmName string
 
19
        values    map[string]interface{}
 
20
        config    string
 
21
        err       error
22
22
}
23
23
 
24
 
func (f *fakeServiceAPI) Update(args params.ApplicationUpdate) error {
 
24
func (f *fakeApplicationAPI) Update(args params.ApplicationUpdate) error {
25
25
        if f.err != nil {
26
26
                return f.err
27
27
        }
28
28
 
29
 
        if args.ApplicationName != f.serviceName {
 
29
        if args.ApplicationName != f.name {
30
30
                return errors.NotFoundf("application %q", args.ApplicationName)
31
31
        }
32
32
 
34
34
        return nil
35
35
}
36
36
 
37
 
func (f *fakeServiceAPI) Close() error {
 
37
func (f *fakeApplicationAPI) Close() error {
38
38
        return nil
39
39
}
40
40
 
41
 
func (f *fakeServiceAPI) Get(application string) (*params.ApplicationGetResults, error) {
42
 
        if application != f.serviceName {
 
41
func (f *fakeApplicationAPI) Get(application string) (*params.ApplicationGetResults, error) {
 
42
        if application != f.name {
43
43
                return nil, errors.NotFoundf("application %q", application)
44
44
        }
45
45
 
53
53
        }
54
54
 
55
55
        return &params.ApplicationGetResults{
56
 
                Application: f.serviceName,
 
56
                Application: f.name,
57
57
                Charm:       f.charmName,
58
58
                Config:      configInfo,
59
59
        }, nil
60
60
}
61
61
 
62
 
func (f *fakeServiceAPI) Set(application string, options map[string]string) error {
 
62
func (f *fakeApplicationAPI) Set(application string, options map[string]string) error {
63
63
        if f.err != nil {
64
64
                return f.err
65
65
        }
66
66
 
67
 
        if application != f.serviceName {
 
67
        if application != f.name {
68
68
                return errors.NotFoundf("application %q", application)
69
69
        }
70
70
 
78
78
        return nil
79
79
}
80
80
 
81
 
func (f *fakeServiceAPI) Unset(application string, options []string) error {
 
81
func (f *fakeApplicationAPI) Unset(application string, options []string) error {
82
82
        if f.err != nil {
83
83
                return f.err
84
84
        }
85
85
 
86
 
        if application != f.serviceName {
 
86
        if application != f.name {
87
87
                return errors.NotFoundf("application %q", application)
88
88
        }
89
89