Пример #1
0
func (s *UsersCommandSuite) TestEnvUsersFormatJson(c *gc.C) {
	context, err := testing.RunCommand(c, environment.NewUsersCommandForTest(s.fake), "-e", "dummyenv", "--format", "json")
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(testing.Stdout(context), gc.Equals, "["+
		`{"user-name":"admin@local","date-created":"2014-07-20","last-connection":"2015-03-20"},`+
		`{"user-name":"bob@local","date-created":"2015-02-15","last-connection":"2015-03-01"},`+
		`{"user-name":"*****@*****.**","date-created":"2015-02-15","last-connection":"never connected"}`+
		"]\n")
}
Пример #2
0
func (s *UsersCommandSuite) TestEnvUsers(c *gc.C) {
	context, err := testing.RunCommand(c, environment.NewUsersCommandForTest(s.fake), "-e", "dummyenv")
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(testing.Stdout(context), gc.Equals, ""+
		"NAME                DATE CREATED  LAST CONNECTION\n"+
		"admin@local         2014-07-20    2015-03-20\n"+
		"bob@local           2015-02-15    2015-03-01\n"+
		"[email protected]  2015-02-15    never connected\n"+
		"\n")
}
Пример #3
0
func (s *UsersCommandSuite) TestUserInfoFormatYaml(c *gc.C) {
	context, err := testing.RunCommand(c, environment.NewUsersCommandForTest(s.fake), "-e", "dummyenv", "--format", "yaml")
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(testing.Stdout(context), gc.Equals, ""+
		"- user-name: admin@local\n"+
		"  date-created: 2014-07-20\n"+
		"  last-connection: 2015-03-20\n"+
		"- user-name: bob@local\n"+
		"  date-created: 2015-02-15\n"+
		"  last-connection: 2015-03-01\n"+
		"- user-name: [email protected]\n"+
		"  date-created: 2015-02-15\n"+
		"  last-connection: never connected\n")
}
Пример #4
0
func (s *UsersCommandSuite) TestUnrecognizedArg(c *gc.C) {
	_, err := testing.RunCommand(c, environment.NewUsersCommandForTest(s.fake), "-e", "dummyenv", "whoops")
	c.Assert(err, gc.ErrorMatches, `unrecognized args: \["whoops"\]`)
}