diff options
author | Ulrik Johansson <ulrik.johansson@gmail.com> | 2019-09-28 23:57:05 +0200 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2019-09-28 14:57:05 -0700 |
commit | 76ad6629350f20acfd6038c1e444a89bcd255f89 (patch) | |
tree | 00439631523c0c7b5df835f33b92f0f8d95f5812 /test/test_admin.py | |
parent | 5e4d1516e0d903e411c71474cc5ba9e9b009cd8c (diff) | |
download | kafka-python-76ad6629350f20acfd6038c1e444a89bcd255f89.tar.gz |
Add ACL api to KafkaAdminClient (#1833)
Diffstat (limited to 'test/test_admin.py')
-rw-r--r-- | test/test_admin.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/test_admin.py b/test/test_admin.py index 300d5bc..279f85a 100644 --- a/test/test_admin.py +++ b/test/test_admin.py @@ -26,6 +26,37 @@ def test_new_partitions(): assert good_partitions.new_assignments == [[1, 2, 3]] +def test_acl_resource(): + good_acl = kafka.admin.ACL( + "User:bar", + "*", + kafka.admin.ACLOperation.ALL, + kafka.admin.ACLPermissionType.ALLOW, + kafka.admin.ResourcePattern( + kafka.admin.ResourceType.TOPIC, + "foo", + kafka.admin.ACLResourcePatternType.LITERAL + ) + ) + + assert(good_acl.resource_pattern.resource_type == kafka.admin.ResourceType.TOPIC) + assert(good_acl.operation == kafka.admin.ACLOperation.ALL) + assert(good_acl.permission_type == kafka.admin.ACLPermissionType.ALLOW) + assert(good_acl.resource_pattern.pattern_type == kafka.admin.ACLResourcePatternType.LITERAL) + + with pytest.raises(IllegalArgumentError): + kafka.admin.ACL( + "User:bar", + "*", + kafka.admin.ACLOperation.ANY, + kafka.admin.ACLPermissionType.ANY, + kafka.admin.ResourcePattern( + kafka.admin.ResourceType.TOPIC, + "foo", + kafka.admin.ACLResourcePatternType.LITERAL + ) + ) + def test_new_topic(): with pytest.raises(IllegalArgumentError): bad_topic = kafka.admin.NewTopic('foo', -1, -1) |