Skip to content

Commit d4d3a82

Browse files
committed
Fix python3 .keys() as a view failures
1 parent 68344ab commit d4d3a82

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/saml2/cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def entities(self, name_id):
139139
:return: A possibly empty list of entity identifiers
140140
"""
141141
cni = code(name_id)
142-
return self._db[cni].keys()
142+
return list(self._db[cni].keys())
143143

144144
def receivers(self, name_id):
145145
""" Another name for entities() just to make it more logic in the IdP

src/saml2/client_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def _sso_location(self, entityid=None, binding=BINDING_HTTP_REDIRECT):
149149
raise IdpUnspecified("Too many IdPs to choose from: %s" % eids)
150150

151151
try:
152-
srvs = self.metadata.single_sign_on_service(eids.keys()[0], binding)
152+
srvs = self.metadata.single_sign_on_service(list(eids.keys())[0], binding)
153153
return destinations(srvs)[0]
154154
except IndexError:
155155
raise IdpUnspecified("No IdP to send to given the premises")

tests/test_51_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def test_create_auth_request_0(self):
268268
assert nid_policy.format == saml.NAMEID_FORMAT_TRANSIENT
269269

270270
def test_create_auth_request_vo(self):
271-
assert self.client.config.vorg.keys() == [
271+
assert list(self.client.config.vorg.keys()) == [
272272
"urn:mace:example.com:it:tek"]
273273

274274
ar_str = "%s" % self.client.create_authn_request(
@@ -1257,7 +1257,7 @@ def test_logout_1(self):
12571257
print(resp)
12581258
assert resp
12591259
assert len(resp) == 1
1260-
assert resp.keys() == entity_ids
1260+
assert list(resp.keys()) == entity_ids
12611261
response = resp[entity_ids[0]]
12621262
assert isinstance(response, LogoutResponse)
12631263

0 commit comments

Comments
 (0)