From 2d10c70349db529c3e2ddbdba17e9f7ef661a40b Mon Sep 17 00:00:00 2001 From: Cedric Paillet Date: Tue, 14 May 2024 06:57:01 +0000 Subject: [PATCH] create acl folder move token code to acl/token.py --- consul/api/acl/__init__.py | 7 +++++++ consul/api/{acl.py => acl/token.py} | 6 ------ tests/api/test_acl.py | 16 ++++++++-------- 3 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 consul/api/acl/__init__.py rename consul/api/{acl.py => acl/token.py} (97%) diff --git a/consul/api/acl/__init__.py b/consul/api/acl/__init__.py new file mode 100644 index 0000000..bcf36a5 --- /dev/null +++ b/consul/api/acl/__init__.py @@ -0,0 +1,7 @@ +from consul.api.acl.token import Token + + +class ACL: + def __init__(self, agent): + self.agent = agent + self.token = Token(agent) diff --git a/consul/api/acl.py b/consul/api/acl/token.py similarity index 97% rename from consul/api/acl.py rename to consul/api/acl/token.py index 13a5be1..a0ad534 100644 --- a/consul/api/acl.py +++ b/consul/api/acl/token.py @@ -3,12 +3,6 @@ from consul.callback import CB -class ACL: - def __init__(self, agent): - self.agent = agent - self.token = Token(agent) - - class Token: def __init__(self, agent): self.agent = agent diff --git a/tests/api/test_acl.py b/tests/api/test_acl.py index 510b8cb..150534d 100644 --- a/tests/api/test_acl.py +++ b/tests/api/test_acl.py @@ -5,7 +5,7 @@ class TestConsulAcl: - def test_acl_permission_denied(self, acl_consul): + def test_acl_token_permission_denied(self, acl_consul): port, _master_token, _consul_version = acl_consul c = consul.Consul(port=port) @@ -49,7 +49,7 @@ def test_acl_permission_denied(self, acl_consul): token="anonymous", ) - def test_acl_list(self, acl_consul): + def test_acl_token_list(self, acl_consul): port, master_token, _consul_version = acl_consul c = consul.Consul(port=port) @@ -68,7 +68,7 @@ def test_acl_list(self, acl_consul): assert find_recursive(acls, master_token_repr) assert find_recursive(acls, anonymous_token_repr) - def test_acl_read(self, acl_consul): + def test_acl_token_read(self, acl_consul): port, master_token, _consul_version = acl_consul c = consul.Consul(port=port) @@ -82,7 +82,7 @@ def test_acl_read(self, acl_consul): acl = c.acl.token.read(accessor_id="00000000-0000-0000-0000-000000000002", token=master_token) assert find_recursive(acl, anonymous_token_repr) - def test_acl_create(self, acl_consul): + def test_acl_token_create(self, acl_consul): port, master_token, _consul_version = acl_consul c = consul.Consul(port=port) @@ -116,7 +116,7 @@ def test_acl_create(self, acl_consul): acl = c.acl.token.list(token=master_token) assert find_recursive(acl, expected) - def test_acl_clone(self, acl_consul): + def test_acl_token_clone(self, acl_consul): port, master_token, _consul_version = acl_consul c = consul.Consul(port=port) @@ -140,7 +140,7 @@ def test_acl_clone(self, acl_consul): acl = c.acl.token.list(token=master_token) assert find_recursive(acl, expected) - def test_acl_update(self, acl_consul): + def test_acl_token_update(self, acl_consul): port, master_token, _consul_version = acl_consul c = consul.Consul(port=port) @@ -164,7 +164,7 @@ def test_acl_update(self, acl_consul): acl = c.acl.token.read(accessor_id="00000000-DEAD-BEEF-0000-000000000000", token=master_token) assert find_recursive(acl, expected) - def test_acl_delete(self, acl_consul): + def test_acl_token_delete(self, acl_consul): port, master_token, _consul_version = acl_consul c = consul.Consul(port=port) @@ -184,7 +184,7 @@ def test_acl_delete(self, acl_consul): ) # - # def test_acl_implicit_token_use(self, acl_consul): + # def test_acl_token_implicit_token_use(self, acl_consul): # # configure client to use the master token by default # port, _token, _consul_version = acl_consul # c = consul.Consul(port=port)