Ejemplo n.º 1
0
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 := model.NewSetCommandForTest(s.fake)
		err := testing.InitCommand(setCmd, test.args)
		c.Check(err, gc.ErrorMatches, test.errorMatch)
	}
}
Ejemplo n.º 2
0
func (s *SetSuite) run(c *gc.C, args ...string) (*cmd.Context, error) {
	command := model.NewSetCommandForTest(s.fake)
	return testing.RunCommand(c, command, args...)
}