~themue/pyjuju/go-state-auth

« back to all changes in this revision

Viewing changes to cmd/juju/command_test.go

  • Committer: William Reade
  • Date: 2012-01-20 21:32:53 UTC
  • mto: This revision was merged to the branch mainline in revision 47.
  • Revision ID: fwereade@gmail.com-20120120213253-csks5e12opl8t1rq
hefty rearrangement, few actual changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package control_test
 
1
package main_test
2
2
 
3
3
import (
4
4
        "flag"
5
5
        "fmt"
6
6
        . "launchpad.net/gocheck"
7
 
        "launchpad.net/juju/go/control"
 
7
        main "launchpad.net/juju/go/cmd/juju"
8
8
        "testing"
9
9
)
10
10
 
32
32
        return fmt.Errorf("This doesn't work, but value is %s.", c.value)
33
33
}
34
34
 
35
 
func parseEmpty(args []string) (*control.JujuCommand, error) {
36
 
        jc := new(control.JujuCommand)
 
35
func parseEmpty(args []string) (*main.JujuCommand, error) {
 
36
        jc := new(main.JujuCommand)
37
37
        err := jc.Parse(args)
38
38
        return jc, err
39
39
}
40
40
 
41
 
func parseDefenestrate(args []string) (*control.JujuCommand, *testCommand, error) {
42
 
        jc := new(control.JujuCommand)
 
41
func parseDefenestrate(args []string) (*main.JujuCommand, *testCommand, error) {
 
42
        jc := new(main.JujuCommand)
43
43
        tc := new(testCommand)
44
44
        jc.Register("defenestrate", tc)
45
45
        err := jc.Parse(args)
69
69
}
70
70
 
71
71
func (s *CommandSuite) TestRegister(c *C) {
72
 
        jc := new(control.JujuCommand)
 
72
        jc := new(main.JujuCommand)
73
73
        err := jc.Register("flip", new(testCommand))
74
74
        c.Assert(err, IsNil)
75
75
 
140
140
        c.Assert(err, ErrorMatches, "no subcommand selected")
141
141
}
142
142
 
 
143
/*
143
144
func (s *CommandSuite) TestJujuMainCommand(c *C) {
144
 
        jmc := control.JujuMainCommand()
 
145
        jmc := main.JujuMainCommand()
145
146
        // Precise errors are not interesting here, this is a very high-level test
146
147
        assertParses := func(args []string) { c.Assert(jmc.Parse(args), IsNil) }
147
148
        assertErrors := func(args []string) { c.Assert(jmc.Parse(args), NotNil) }
164
165
        assertErrors([]string{"juju", "bootstrap", "-v"})
165
166
        assertErrors([]string{"juju", "bootstrap", "-l", "some.log"})
166
167
}
 
168
*/