From c272f2f075f819923335a2368edc6293ee3e295c Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 17 Jan 2020 12:00:51 +0000 Subject: [PATCH] fix lint --- matrix_synapse_saml_mozilla/__init__.py | 2 +- matrix_synapse_saml_mozilla/_sessions.py | 3 +-- matrix_synapse_saml_mozilla/mapping_provider.py | 4 ++-- matrix_synapse_saml_mozilla/username_picker.py | 2 +- tests/__init__.py | 2 +- tests/test_attributes.py | 6 ++++-- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/matrix_synapse_saml_mozilla/__init__.py b/matrix_synapse_saml_mozilla/__init__.py index 82a9b3f..7ebaf5d 100644 --- a/matrix_synapse_saml_mozilla/__init__.py +++ b/matrix_synapse_saml_mozilla/__init__.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from pkg_resources import get_distribution, DistributionNotFound +from pkg_resources import DistributionNotFound, get_distribution from matrix_synapse_saml_mozilla.mapping_provider import SamlMappingProvider from matrix_synapse_saml_mozilla.username_picker import pick_username_resource diff --git a/matrix_synapse_saml_mozilla/_sessions.py b/matrix_synapse_saml_mozilla/_sessions.py index 0c9bf79..05eb0ab 100644 --- a/matrix_synapse_saml_mozilla/_sessions.py +++ b/matrix_synapse_saml_mozilla/_sessions.py @@ -13,11 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. import logging +import time from typing import Optional import attr -import time - SESSION_COOKIE_NAME = b"username_mapping_session" diff --git a/matrix_synapse_saml_mozilla/mapping_provider.py b/matrix_synapse_saml_mozilla/mapping_provider.py index edd79ab..4f8891c 100644 --- a/matrix_synapse_saml_mozilla/mapping_provider.py +++ b/matrix_synapse_saml_mozilla/mapping_provider.py @@ -26,10 +26,10 @@ from synapse.api.errors import CodeMessageException from synapse.module_api.errors import RedirectException from matrix_synapse_saml_mozilla._sessions import ( + SESSION_COOKIE_NAME, UsernameMappingSession, - username_mapping_sessions, expire_old_sessions, - SESSION_COOKIE_NAME, + username_mapping_sessions, ) logger = logging.getLogger(__name__) diff --git a/matrix_synapse_saml_mozilla/username_picker.py b/matrix_synapse_saml_mozilla/username_picker.py index c109e47..ddd689e 100644 --- a/matrix_synapse_saml_mozilla/username_picker.py +++ b/matrix_synapse_saml_mozilla/username_picker.py @@ -28,9 +28,9 @@ from synapse.module_api import run_in_background from synapse.module_api.errors import SynapseError from matrix_synapse_saml_mozilla._sessions import ( + SESSION_COOKIE_NAME, get_mapping_session, username_mapping_sessions, - SESSION_COOKIE_NAME, ) """ diff --git a/tests/__init__.py b/tests/__init__.py index 26f9c96..97d6b43 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,4 +1,4 @@ -from typing import Optional, Tuple +from typing import Optional from matrix_synapse_saml_mozilla import SamlMappingProvider diff --git a/tests/test_attributes.py b/tests/test_attributes.py index 6d85e68..de405ca 100644 --- a/tests/test_attributes.py +++ b/tests/test_attributes.py @@ -23,8 +23,10 @@ from saml2.config import SPConfig from saml2.response import AuthnResponse from saml2.sigver import security_context -from matrix_synapse_saml_mozilla._sessions import username_mapping_sessions from synapse.api.errors import RedirectException + +from matrix_synapse_saml_mozilla._sessions import username_mapping_sessions + from . import create_mapping_provider logging.basicConfig() @@ -65,7 +67,7 @@ def _load_test_response() -> AuthnResponse: class SamlUserAttributeTestCase(unittest.TestCase): def test_get_remote_user_id_from_name_id(self): resp = _load_test_response() - provider = create_mapping_provider({"use_name_id_for_remote_uid": True,}) + provider = create_mapping_provider({"use_name_id_for_remote_uid": True}) remote_user_id = provider.get_remote_user_id(resp, "",) self.assertEqual(remote_user_id, "test@domain.com")