diff --git a/consul/api/acl/__init__.py b/consul/api/acl/__init__.py new file mode 100644 index 0000000..9248eb8 --- /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 = self.tokens = 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 1f75172..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 = self.tokens = 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 1325db3..a23be93 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): c, _master_token, _consul_version = acl_consul # No token @@ -48,7 +48,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): c, master_token, _consul_version = acl_consul # Make sure both master and anonymous tokens are created @@ -66,7 +66,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): c, master_token, _consul_version = acl_consul # Unknown token @@ -79,7 +79,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): c, master_token, _consul_version = acl_consul c.acl.token.create(accessor_id="00000000-DEAD-BEEF-0000-000000000000", token=master_token) @@ -112,7 +112,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): c, master_token, _consul_version = acl_consul assert len(c.acl.token.list(token=master_token)) == 2 @@ -135,7 +135,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): c, master_token, _consul_version = acl_consul # Unknown token @@ -158,7 +158,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): c, master_token, _consul_version = acl_consul assert len(c.acl.token.list(token=master_token)) == 2 @@ -177,7 +177,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)