Skip to content

Commit 66c321d

Browse files
skorandac00kiemon5ter
authored andcommitted
Formatting to be flake8 compliant
1 parent 3bce02a commit 66c321d

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

src/satosa/internal_data.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ def hash_type(state):
6767
@staticmethod
6868
def hash_id(salt, user_id, requester, state):
6969
"""
70-
Sets a user id to the internal_response, in the format specified by the internal response
70+
Sets a user id to the internal_response,
71+
in the format specified by the internal response
7172
7273
:type salt: str
7374
:type user_id: str
@@ -84,13 +85,15 @@ def hash_id(salt, user_id, requester, state):
8485
hash_type = UserIdHasher.hash_type(state)
8586
if hash_type == UserIdHashType.transient:
8687
timestamp = datetime.datetime.now().time()
87-
user_id = "{req}{time}{id}".format(req=requester, time=timestamp, id=user_id)
88-
elif hash_type == UserIdHashType.persistent or hash_type == UserIdHashType.pairwise:
88+
user_id = "{req}{time}{id}".format(req=requester, time=timestamp,
89+
id=user_id)
90+
elif (hash_type == UserIdHashType.persistent or
91+
hash_type == UserIdHashType.pairwise):
8992
user_id = "{req}{id}".format(req=requester, id=user_id)
9093
elif hash_type == UserIdHashType.public:
9194
user_id = "{id}".format(id=user_id)
92-
elif hash_type == UserIdHashType.emailaddress or \
93-
hash_type == UserIdHashType.unspecified:
95+
elif (hash_type == UserIdHashType.emailaddress or
96+
hash_type == UserIdHashType.unspecified):
9497
return user_id
9598
else:
9699
raise ValueError("Unknown hash type: '{}'".format(hash_type))

tests/satosa/frontends/test_saml2.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,16 +360,21 @@ def test_load_idp_dynamic_entity_id(self, idp_conf):
360360

361361
class TestSamlNameIdFormatToHashType:
362362
def test_should_default_to_transient(self):
363-
assert saml_name_id_format_to_hash_type("foobar") == UserIdHashType.transient
363+
assert (saml_name_id_format_to_hash_type("foobar") ==
364+
UserIdHashType.transient)
364365

365366
def test_should_map_transient(self):
366-
assert saml_name_id_format_to_hash_type(NAMEID_FORMAT_TRANSIENT) == UserIdHashType.transient
367+
assert (saml_name_id_format_to_hash_type(NAMEID_FORMAT_TRANSIENT) ==
368+
UserIdHashType.transient)
367369

368370
def test_should_map_persistent(self):
369-
assert saml_name_id_format_to_hash_type(NAMEID_FORMAT_PERSISTENT) == UserIdHashType.persistent
371+
assert (saml_name_id_format_to_hash_type(NAMEID_FORMAT_PERSISTENT) ==
372+
UserIdHashType.persistent)
370373

371374
def test_should_map_email(self):
372-
assert saml_name_id_format_to_hash_type(NAMEID_FORMAT_EMAILADDRESS) == UserIdHashType.emailaddress
375+
assert (saml_name_id_format_to_hash_type(NAMEID_FORMAT_EMAILADDRESS) ==
376+
UserIdHashType.emailaddress)
373377

374378
def test_should_map_unspecified(self):
375-
assert saml_name_id_format_to_hash_type(NAMEID_FORMAT_UNSPECIFIED) == UserIdHashType.unspecified
379+
assert (saml_name_id_format_to_hash_type(NAMEID_FORMAT_UNSPECIFIED) ==
380+
UserIdHashType.unspecified)

0 commit comments

Comments
 (0)