-
Notifications
You must be signed in to change notification settings - Fork 18
/
describe_acls_request_test.go
49 lines (42 loc) · 1.1 KB
/
describe_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
45
46
47
48
49
package healer
import (
"testing"
"github.com/smartystreets/goconvey/convey"
)
func TestDescribeAclsRequestEncodeAndDecode(t *testing.T) {
convey.Convey("Test DescribeAclsRequest Encode and Decode at version 1 and 2", t, func() {
var (
resourceName = "test-resource"
principal = "test-principal"
host = "test-host"
)
var version uint16
for version = 0; version <= 2; version++ {
original := DescribeAclsRequest{
RequestHeader: RequestHeader{
APIKey: API_DescribeAcls,
APIVersion: version,
CorrelationID: 10,
},
DescribeAclsRequestBody: DescribeAclsRequestBody{
ResourceType: 1,
ResourceName: &resourceName,
PatternType: 3,
Principal: &principal,
Host: &host,
Operation: 2,
PermissionType: 3,
},
}
if version == 0 {
original.PatternType = 0
}
encoded := original.Encode(version)
decoded, err := DecodeDescribeAclsRequest(encoded, version)
if err != nil {
t.Errorf("decode error: %v", err)
}
convey.So(decoded, convey.ShouldResemble, original)
}
})
}