Skip to content

Commit

Permalink
create acl folder
Browse files Browse the repository at this point in the history
move token code to acl/token.py
  • Loading branch information
cpaillet committed May 15, 2024
1 parent c55c556 commit 883f6b4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
7 changes: 7 additions & 0 deletions consul/api/acl/__init__.py
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 0 additions & 6 deletions consul/api/acl.py → consul/api/acl/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions tests/api/test_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 883f6b4

Please sign in to comment.