16263: Decodes JSON numbers as strings instead of float64.
[arvados.git] / lib / cli / get_test.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: Apache-2.0
4
5 package cli
6
7 import (
8         "bytes"
9         "regexp"
10         "testing"
11
12         "git.arvados.org/arvados.git/sdk/go/arvadostest"
13         check "gopkg.in/check.v1"
14 )
15
16 // Gocheck boilerplate
17 func Test(t *testing.T) {
18         check.TestingT(t)
19 }
20
21 var _ = check.Suite(&GetSuite{})
22
23 type GetSuite struct{}
24
25 func (s *GetSuite) TestGetCollectionJSON(c *check.C) {
26         stdout := bytes.NewBuffer(nil)
27         stderr := bytes.NewBuffer(nil)
28         exited := Get.RunCommand("arvados-client get", []string{arvadostest.FooCollection}, bytes.NewReader(nil), stdout, stderr)
29         c.Check(stdout.String(), check.Matches, `(?ms){.*"uuid": "`+arvadostest.FooCollection+`".*}\n`)
30         c.Check(stdout.String(), check.Matches, `(?ms){.*"portable_data_hash": "`+regexp.QuoteMeta(arvadostest.FooCollectionPDH)+`".*}\n`)
31         c.Check(stderr.String(), check.Equals, "")
32         c.Check(exited, check.Equals, 0)
33 }