1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
10 "git.arvados.org/arvados.git/sdk/go/arvados"
11 "git.arvados.org/arvados.git/sdk/go/arvadostest"
12 check "gopkg.in/check.v1"
15 var _ = check.Suite(&GroupSuite{})
17 type GroupSuite struct {
21 func makeConn() (*Conn, *arvadostest.APIStub, *arvadostest.APIStub) {
22 localAPIstub := &arvadostest.APIStub{Error: errors.New("No result")}
23 remoteAPIstub := &arvadostest.APIStub{Error: errors.New("No result")}
24 return &Conn{&arvados.Cluster{ClusterID: "local"}, localAPIstub, map[string]backend{"zzzzz": remoteAPIstub}}, localAPIstub, remoteAPIstub
27 func (s *UserSuite) TestGroupContents(c *check.C) {
28 conn, localAPIstub, remoteAPIstub := makeConn()
29 conn.GroupContents(s.ctx, arvados.GroupContentsOptions{UUID: "local-tpzed-xurymjxw79nv3jz"})
30 c.Check(len(localAPIstub.Calls(nil)), check.Equals, 1)
31 c.Check(len(remoteAPIstub.Calls(nil)), check.Equals, 0)
33 conn, localAPIstub, remoteAPIstub = makeConn()
34 conn.GroupContents(s.ctx, arvados.GroupContentsOptions{UUID: "zzzzz-tpzed-xurymjxw79nv3jz"})
35 c.Check(len(localAPIstub.Calls(nil)), check.Equals, 1)
36 c.Check(len(remoteAPIstub.Calls(nil)), check.Equals, 0)
38 conn, localAPIstub, remoteAPIstub = makeConn()
39 conn.GroupContents(s.ctx, arvados.GroupContentsOptions{UUID: "local-j7d0g-xurymjxw79nv3jz"})
40 c.Check(len(localAPIstub.Calls(nil)), check.Equals, 1)
41 c.Check(len(remoteAPIstub.Calls(nil)), check.Equals, 0)
43 conn, localAPIstub, remoteAPIstub = makeConn()
44 conn.GroupContents(s.ctx, arvados.GroupContentsOptions{UUID: "zzzzz-j7d0g-xurymjxw79nv3jz"})
45 c.Check(len(localAPIstub.Calls(nil)), check.Equals, 0)
46 c.Check(len(remoteAPIstub.Calls(nil)), check.Equals, 1)
48 conn, localAPIstub, remoteAPIstub = makeConn()
49 conn.GroupContents(s.ctx, arvados.GroupContentsOptions{UUID: "zzzzz-tpzed-xurymjxw79nv3jz", ClusterID: "zzzzz"})
50 c.Check(len(localAPIstub.Calls(nil)), check.Equals, 0)
51 c.Check(len(remoteAPIstub.Calls(nil)), check.Equals, 1)