-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepository_test.go
53 lines (44 loc) · 1.07 KB
/
repository_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package cloudcms
import (
"fmt"
"testing"
)
func TestRepositories(t *testing.T) {
session, err := ConnectDefault()
if err != nil {
t.Fatal(err)
}
repository, err := session.CreateRepository(nil)
if err != nil {
t.Fatal(err)
}
repository, err = session.ReadRepository(ExtractId(&repository))
if err != nil {
t.Fatal(err)
}
if repository == nil {
t.Fatal("No repository")
}
branches, err := session.QueryBranches(ExtractId(&repository), make(JsonObject), nil)
if err != nil {
t.Fatal(err)
}
for _, branch := range branches.rows {
node, err := session.QueryOneNode(ExtractId(&repository), ExtractId(&branch), nil)
if err != nil {
t.Fatal(err)
}
fmt.Println(ExtractId(&node))
nodes, err := session.QueryNodes(ExtractId(&repository), ExtractId(&branch), nil, nil)
if err != nil {
t.Fatal(err)
}
for _, node := range nodes.rows {
fmt.Printf("Repository: %s, Branch: %s, Node: %s\n", ExtractId(&repository), ExtractId(&branch), ExtractId(&node))
}
}
err = session.DeleteRepository(ExtractId(&repository))
if err != nil {
t.Fatal(err)
}
}