File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,10 +135,10 @@ def create_role(self,
135135 return self ._put_response_body (
136136 ["role" ], {},
137137 dict (
138- model .ACLPolicy (name = name ,
139- description = description ,
140- policies = policies ,
141- service_identities = service_identities )))
138+ model .ACLRole (name = name ,
139+ description = description ,
140+ policies = policies ,
141+ service_identities = service_identities )))
142142
143143 def update_role (self ,
144144 id ,
@@ -159,10 +159,10 @@ def update_role(self,
159159 return self ._put_response_body (
160160 ["role" , id ], {},
161161 dict (
162- model .ACLPolicy (name = name ,
163- description = description ,
164- policies = policies ,
165- service_identities = service_identities )))
162+ model .ACLRole (name = name ,
163+ description = description ,
164+ policies = policies ,
165+ service_identities = service_identities )))
166166
167167 def delete_role (self , id ):
168168 """Delete an existing role with the given ID.
Original file line number Diff line number Diff line change 88def _validate_link_array (value , model ):
99 """ Validate the policies or roles links are formatted correctly.
1010
11- :param list(dict()) value: An array of PolicyLink or RoleLink.
12- :param rtype: bool
13- :param consulate.models.agent.Check model: The model instance.
11+ :param list value: An array of PolicyLink or RoleLink.
1412 :param rtype: bool
1513
1614 """
17- return all (['ID' in link or 'Name' in link
18- for link in value ]) and not model .args
15+ return all (['ID' in link or 'Name' in link for link in value ])
1916
2017
2118def _validate_service_identities (value , model ):
2219 """ Validate service_identities is formatted correctly.
2320
24- :param list(dict()) value: A ServiceIdentity list
21+ :param ServiceIdentities value: A ServiceIdentity list
2522 :param rtype: bool
2623
2724 """
2825 return all (
29- ['ServiceName' in service_identity
30- for service_identity in value ]) and not model .args
26+ ['ServiceName' in service_identity for service_identity in value ])
3127
3228
3329class ACLPolicy (base .Model ):
Original file line number Diff line number Diff line change 3737"""
3838
3939POLICYLINKS_SAMPLE = [
40- dict (ID = "783beef3-783f-f41f-7422-7087dc272765 " ),
40+ dict (Name = "policylink_sample " ),
4141]
4242
4343POLICYLINKS_UPDATE_SAMPLE = [
44- dict (ID = "783beef3-783f-f41f-7422-7087dc272765 " ),
45- dict (Name = "some_policy_name " )
44+ dict (Name = "policylink_sample " ),
45+ dict (Name = "policylink_update_sample " )
4646]
4747
4848SERVICE_IDENTITIES_SAMPLE = [dict (ServiceName = "db" , Datacenters = ["dc1" ])]
4949
50- ROLELINKS_SAMPLE = [dict (Name = "some_role_name " )]
50+ ROLELINKS_SAMPLE = [dict (Name = "role_sample " )]
5151
5252
5353class TestCase (base .TestCase ):
Original file line number Diff line number Diff line change @@ -52,11 +52,11 @@ def tearDown(self):
5252 for name in services :
5353 self .consul .agent .service .deregister (services [name ]['ID' ])
5454
55- for acl in self .consul .acl .list ():
56- if acl ['ID ' ] == CONSUL_CONFIG ['acl' ]['tokens' ]['master' ]:
55+ for acl in self .consul .acl .list_tokens ():
56+ if acl ['AccessorID ' ] == CONSUL_CONFIG ['acl' ]['tokens' ]['master' ]:
5757 continue
5858 try :
59- uuid .UUID (acl ['ID ' ])
60- self .consul .acl .destroy (acl ['ID ' ])
59+ uuid .UUID (acl ['AccessorID ' ])
60+ self .consul .acl .delete_token (acl ['AccessorID ' ])
6161 except (ValueError , exceptions .ConsulateException ):
6262 pass
You can’t perform that action at this time.
0 commit comments