X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/243f15e69ed3a5514be89115d3ec231551d31cb8..6def96daca7a5ec60dc067c04864bc58bd4aaf5c:/lib/cli/get_test.go diff --git a/lib/cli/get_test.go b/lib/cli/get_test.go new file mode 100644 index 0000000000..9b8f1a0089 --- /dev/null +++ b/lib/cli/get_test.go @@ -0,0 +1,33 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +package cli + +import ( + "bytes" + "regexp" + "testing" + + "git.curoverse.com/arvados.git/sdk/go/arvadostest" + check "gopkg.in/check.v1" +) + +// Gocheck boilerplate +func Test(t *testing.T) { + check.TestingT(t) +} + +var _ = check.Suite(&GetSuite{}) + +type GetSuite struct{} + +func (s *GetSuite) TestGetCollectionJSON(c *check.C) { + stdout := bytes.NewBuffer(nil) + stderr := bytes.NewBuffer(nil) + exited := Get("arvados-client get", []string{arvadostest.FooCollection}, bytes.NewReader(nil), stdout, stderr) + c.Check(stdout.String(), check.Matches, `(?ms){.*"uuid": "`+arvadostest.FooCollection+`".*}\n`) + c.Check(stdout.String(), check.Matches, `(?ms){.*"portable_data_hash": "`+regexp.QuoteMeta(arvadostest.FooCollectionPDH)+`".*}\n`) + c.Check(stderr.String(), check.Equals, "") + c.Check(exited, check.Equals, 0) +}