forked from IBM/sarama
-
Notifications
You must be signed in to change notification settings - Fork 1
/
acl_create_request_test.go
70 lines (64 loc) · 1.46 KB
/
acl_create_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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package sarama
import "testing"
var (
aclCreateRequest = []byte{
0, 0, 0, 1,
3, // resource type = group
0, 5, 'g', 'r', 'o', 'u', 'p',
0, 9, 'p', 'r', 'i', 'n', 'c', 'i', 'p', 'a', 'l',
0, 4, 'h', 'o', 's', 't',
2, // all
2, // deny
}
aclCreateRequestv1 = []byte{
0, 0, 0, 1,
3, // resource type = group
0, 5, 'g', 'r', 'o', 'u', 'p',
3, // resource pattten type = literal
0, 9, 'p', 'r', 'i', 'n', 'c', 'i', 'p', 'a', 'l',
0, 4, 'h', 'o', 's', 't',
2, // all
2, // deny
}
)
func TestCreateAclsRequestv0(t *testing.T) {
req := &CreateAclsRequest{
Version: 0,
AclCreations: []*AclCreation{
{
Resource: Resource{
ResourceType: AclResourceGroup,
ResourceName: "group",
},
Acl: Acl{
Principal: "principal",
Host: "host",
Operation: AclOperationAll,
PermissionType: AclPermissionDeny,
},
},
},
}
testRequest(t, "create request", req, aclCreateRequest)
}
func TestCreateAclsRequestv1(t *testing.T) {
req := &CreateAclsRequest{
Version: 1,
AclCreations: []*AclCreation{
{
Resource: Resource{
ResourceType: AclResourceGroup,
ResourceName: "group",
ResourcePatternType: AclPatternLiteral,
},
Acl: Acl{
Principal: "principal",
Host: "host",
Operation: AclOperationAll,
PermissionType: AclPermissionDeny,
},
},
},
}
testRequest(t, "create request v1", req, aclCreateRequestv1)
}