Esempio n. 1
0
func (s *unshareSuite) TestInit(c *gc.C) {
	wrappedCommand, unshareCmd := environment.NewUnshareCommandForTest(s.fake)
	err := testing.InitCommand(wrappedCommand, []string{})
	c.Assert(err, gc.ErrorMatches, "no users specified")

	err = testing.InitCommand(wrappedCommand, []string{"not valid/0"})
	c.Assert(err, gc.ErrorMatches, `invalid username: "******"`)

	err = testing.InitCommand(wrappedCommand, []string{"bob@local", "sam"})
	c.Assert(err, jc.ErrorIsNil)

	c.Assert(unshareCmd.Users[0], gc.Equals, names.NewUserTag("bob@local"))
	c.Assert(unshareCmd.Users[1], gc.Equals, names.NewUserTag("sam"))
}
Esempio n. 2
0
func (s *unshareSuite) run(c *gc.C, args ...string) (*cmd.Context, error) {
	command, _ := environment.NewUnshareCommandForTest(s.fake)
	return testing.RunCommand(c, command, args...)
}