summaryrefslogtreecommitdiff
path: root/test/test_admin.py
diff options
context:
space:
mode:
authorUlrik Johansson <ulrik.johansson@gmail.com>2019-09-28 23:57:05 +0200
committerDana Powers <dana.powers@gmail.com>2019-09-28 14:57:05 -0700
commit76ad6629350f20acfd6038c1e444a89bcd255f89 (patch)
tree00439631523c0c7b5df835f33b92f0f8d95f5812 /test/test_admin.py
parent5e4d1516e0d903e411c71474cc5ba9e9b009cd8c (diff)
downloadkafka-python-76ad6629350f20acfd6038c1e444a89bcd255f89.tar.gz
Add ACL api to KafkaAdminClient (#1833)
Diffstat (limited to 'test/test_admin.py')
-rw-r--r--test/test_admin.py31
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)