-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathclient_test.go
69 lines (60 loc) · 1.53 KB
/
client_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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package p4
import (
"fmt"
"os"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestClient_Clients(t *testing.T) {
var (
conn *Conn
err error
)
conn, err = setup(t)
Convey("test Clients", t, func() {
So(err, ShouldBeNil)
Convey("List clients", func() {
clients, err := conn.Clients("//DM99.ZGame.Project/Main/ZGame_Mainline")
So(clients, ShouldNotBeEmpty)
So(err, ShouldBeNil)
})
})
}
func TestClient_Client(t *testing.T) {
var (
err error
conn *Conn
)
conn, err = setup(t)
Convey("test Client", t, func() {
So(err, ShouldBeNil)
Convey("Display client", func() {
client, err := conn.Client("root_ZGame_Mainline")
So(client, ShouldNotBeEmpty)
So(err, ShouldBeNil)
})
Convey("Create partitioned client and delete", func() {
owner := os.Getenv("P4USER")
client := owner + "_xxx_ZGame_Mainline"
wsRoot, _ := os.Getwd()
clientInfo := Client{
Client: client,
Owner: owner,
Host: "",
Description: "",
Root: wsRoot + "/" + client,
Options: "noallwrite noclobber nocompress unlocked nomodtime normdir",
SubmitOptions: "submitunchanged",
Stream: "",
Type: "",
View: []string{fmt.Sprintf("//DM99.ZGame.Project/Main/ZGame_Mainline/... //%s/...", client)},
}
message, err := conn.CreatePartitionClient(clientInfo)
So(message, ShouldNotBeEmpty)
So(err, ShouldBeNil)
message, err = conn.DeleteClient(client)
So(message, ShouldNotBeEmpty)
So(err, ShouldBeNil)
})
})
}