1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: Apache-2.0
12 check "gopkg.in/check.v1"
15 // Gocheck boilerplate
16 func Test(t *testing.T) {
20 var _ = check.Suite(&ClientSuite{})
22 type ClientSuite struct{}
24 func (s *ClientSuite) TestBadCommand(c *check.C) {
25 exited := handler.RunCommand("arvados-client", []string{"no such command"}, bytes.NewReader(nil), ioutil.Discard, ioutil.Discard)
26 c.Check(exited, check.Equals, 2)
29 func (s *ClientSuite) TestBadSubcommandArgs(c *check.C) {
30 exited := handler.RunCommand("arvados-client", []string{"get"}, bytes.NewReader(nil), ioutil.Discard, ioutil.Discard)
31 c.Check(exited, check.Equals, 2)
34 func (s *ClientSuite) TestVersion(c *check.C) {
35 stdout := bytes.NewBuffer(nil)
36 stderr := bytes.NewBuffer(nil)
37 exited := handler.RunCommand("arvados-client", []string{"version"}, bytes.NewReader(nil), stdout, stderr)
38 c.Check(exited, check.Equals, 0)
39 c.Check(stdout.String(), check.Matches, `arvados-client dev \(go[0-9\.]+\)\n`)
40 c.Check(stderr.String(), check.Equals, "")