Пример #1
0
func (s *AddUnitSuite) TestInitErrors(c *gc.C) {
	for i, t := range initAddUnitErrorTests {
		c.Logf("test %d", i)
		err := testing.InitCommand(application.NewAddUnitCommandForTest(s.fake), t.args)
		c.Check(err, gc.ErrorMatches, t.err)
	}
}
Пример #2
0
func (s *AddUnitSuite) TestUnauthorizedMentionsJujuGrant(c *gc.C) {
	s.fake.err = &params.Error{
		Message: "permission denied",
		Code:    params.CodeUnauthorized,
	}
	ctx, _ := testing.RunCommand(c, application.NewAddUnitCommandForTest(s.fake), "some-application-name")
	errString := strings.Replace(testing.Stderr(ctx), "\n", " ", -1)
	c.Assert(errString, gc.Matches, `.*juju grant.*`)
}
Пример #3
0
func (s *AddUnitSuite) runAddUnit(c *gc.C, args ...string) error {
	_, err := testing.RunCommand(c, application.NewAddUnitCommandForTest(s.fake), args...)
	return err
}