示例#1
0
文件: set_test.go 项目: imoapps/juju
func (s *SetSuite) TestInit(c *gc.C) {
	for i, test := range []struct {
		args       []string
		errorMatch string
	}{
		{
			errorMatch: "no key, value pairs specified",
		}, {
			args:       []string{"special"},
			errorMatch: `expected "key=value", got "special"`,
		}, {
			args:       []string{"special=extra", "special=other"},
			errorMatch: `key "special" specified more than once`,
		}, {
			args:       []string{"agent-version=2.0.0"},
			errorMatch: "agent-version must be set via upgrade-juju",
		},
	} {
		c.Logf("test %d", i)
		setCmd := environment.NewSetCommandForTest(s.fake)
		err := testing.InitCommand(setCmd, test.args)
		c.Check(err, gc.ErrorMatches, test.errorMatch)
	}
}
示例#2
0
文件: set_test.go 项目: imoapps/juju
func (s *SetSuite) run(c *gc.C, args ...string) (*cmd.Context, error) {
	command := environment.NewSetCommandForTest(s.fake)
	return testing.RunCommand(c, command, args...)
}