-
Notifications
You must be signed in to change notification settings - Fork 18
/
delete_acls_request_test.go
44 lines (35 loc) · 1.04 KB
/
delete_acls_request_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
package healer
import (
"testing"
"github.com/smartystreets/goconvey/convey"
)
func TestDeleteAclsRequestEncodeDecode(t *testing.T) {
convey.Convey("Test DeleteAclsRequest Encode and Decode", t, func() {
for _, version := range availableVersions[API_DeleteAcls] {
t.Logf("version: %v", version)
var clientID = "healer"
var resourceName = "test-topic"
var principal = "User:test"
var host = "*"
filter := &DeleteAclsFilter{
ResourceType: 2, // Topic
ResourceName: &resourceName,
PatternType: 3, // Match
Principal: &principal,
Host: &host,
Operation: 2, // Write
PermissionType: 3, // Allow
}
if version == 0 {
filter.PatternType = 0
}
request := NewDeleteAclsRequest(clientID, []*DeleteAclsFilter{filter})
request.SetCorrelationID(100)
request.SetVersion(version)
encoded := request.Encode(version)
decoded, err := DecodeDeleteAclsRequest(encoded)
convey.So(err, convey.ShouldBeNil)
convey.So(decoded, convey.ShouldResemble, request)
}
})
}