diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,6 +37,6 @@ - id: isort - repo: https://github.com/python/black - rev: 19.10b0 + rev: 22.3.0 hooks: - id: black diff --git a/swh/auth/keycloak.py b/swh/auth/keycloak.py --- a/swh/auth/keycloak.py +++ b/swh/auth/keycloak.py @@ -41,7 +41,9 @@ retrieved if not provided) """ self._keycloak = KeycloakOpenID( - server_url=server_url, client_id=client_id, realm_name=realm_name, + server_url=server_url, + client_id=client_id, + realm_name=realm_name, ) self.server_url = server_url self.realm_public_key = realm_public_key @@ -230,9 +232,7 @@ def keycloak_error_message(keycloak_error: KeycloakError) -> str: - """Transform a keycloak exception into an error message. - - """ + """Transform a keycloak exception into an error message.""" try: # keycloak error wrapped in a JSON document msg_dict = json.loads(keycloak_error.error_message.decode()) diff --git a/swh/auth/pytest_plugin.py b/swh/auth/pytest_plugin.py --- a/swh/auth/pytest_plugin.py +++ b/swh/auth/pytest_plugin.py @@ -59,8 +59,7 @@ user_info: Dict = USER_INFO, raw_realm_public_key: str = RAW_REALM_PUBLIC_KEY, ): - """Constructor - """ + """Constructor""" super().__init__( server_url=server_url, realm_name=realm_name, client_id=client_id ) @@ -182,7 +181,7 @@ raw_realm_public_key: str = RAW_REALM_PUBLIC_KEY, ): """Keycloak mock fixture factory. Report to - :py:class:`swh.auth.pytest_plugin.KeycloackOpenIDConnectMock` docstring. + :py:class:`swh.auth.pytest_plugin.KeycloackOpenIDConnectMock` docstring. """ @@ -213,7 +212,9 @@ # (cf. test_keycloak.py, test_utils.py, django related tests) # or external modules using that pytest plugin _keycloak_oidc = keycloak_oidc_factory( - server_url=SERVER_URL, realm_name=REALM_NAME, client_id=CLIENT_ID, + server_url=SERVER_URL, + realm_name=REALM_NAME, + client_id=CLIENT_ID, ) diff --git a/swh/auth/tests/django/app/apptest/settings.py b/swh/auth/tests/django/app/apptest/settings.py --- a/swh/auth/tests/django/app/apptest/settings.py +++ b/swh/auth/tests/django/app/apptest/settings.py @@ -28,7 +28,10 @@ ROOT_URLCONF = "swh.auth.tests.django.app.apptest.urls" DATABASES = { - "default": {"ENGINE": "django.db.backends.sqlite3", "NAME": "swh-auth-test-db",} + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": "swh-auth-test-db", + } } SESSION_ENGINE = "django.contrib.sessions.backends.cache" diff --git a/swh/auth/tests/django/test_utils.py b/swh/auth/tests/django/test_utils.py --- a/swh/auth/tests/django/test_utils.py +++ b/swh/auth/tests/django/test_utils.py @@ -99,7 +99,9 @@ @override_settings( - SWH_AUTH_SERVER_URL=None, SWH_AUTH_REALM_NAME=None, SWH_AUTH_CLIENT_ID=None, + SWH_AUTH_SERVER_URL=None, + SWH_AUTH_REALM_NAME=None, + SWH_AUTH_CLIENT_ID=None, ) def test_keycloak_oidc_client_missing_django_settings(): diff --git a/swh/auth/tests/test_keycloak.py b/swh/auth/tests/test_keycloak.py --- a/swh/auth/tests/test_keycloak.py +++ b/swh/auth/tests/test_keycloak.py @@ -116,9 +116,7 @@ def test_auth_KeycloakOpenIDConnect_from_config(auth_config): - """Instantiating keycloak client out of configuration dict is possible - - """ + """Instantiating keycloak client out of configuration dict is possible""" client = KeycloakOpenIDConnect.from_config(**auth_config) assert client.server_url == auth_config["keycloak"]["server_url"] @@ -127,9 +125,7 @@ def test_auth_KeycloakOpenIDConnect_from_configfile(auth_config_path, monkeypatch): - """Instantiating keycloak client out of environment variable is possible - - """ + """Instantiating keycloak client out of environment variable is possible""" client = KeycloakOpenIDConnect.from_configfile() auth_config = read(auth_config_path) @@ -145,7 +141,7 @@ """Instantiating keycloak client out of environment variable is possible And caller can override the configuration at calling - """ + """ client = KeycloakOpenIDConnect.from_configfile(client_id="foobar") auth_config = read(auth_config_path) diff --git a/tox.ini b/tox.ini --- a/tox.ini +++ b/tox.ini @@ -17,7 +17,7 @@ [testenv:black] skip_install = true deps = - black==19.10b0 + black==22.3.0 commands = {envpython} -m black --check swh