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