Skip to content
Snippets Groups Projects
Unverified Commit c1490dc2 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

STY: formatting

parent 63d72949
Branches
Tags
No related merge requests found
...@@ -21,8 +21,7 @@ ...@@ -21,8 +21,7 @@
# #
# ** end header # ** end header
# #
"""external_credentials_provider. """external_credentials_provider."""
"""
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
from abc import ABCMeta from abc import ABCMeta
import logging import logging
......
...@@ -126,7 +126,7 @@ class AbstractAuthenticator(ABC): ...@@ -126,7 +126,7 @@ class AbstractAuthenticator(ABC):
def on_request(self, method, path, headers, **kwargs): def on_request(self, method, path, headers, **kwargs):
# pylint: disable=unused-argument # pylint: disable=unused-argument
"""on_request """on_request.
A call-back which is to be called by the connection before each A call-back which is to be called by the connection before each
request. This method set the auth cookie for that request. request. This method set the auth cookie for that request.
...@@ -150,7 +150,7 @@ class AbstractAuthenticator(ABC): ...@@ -150,7 +150,7 @@ class AbstractAuthenticator(ABC):
class CredentialsAuthenticator(AbstractAuthenticator): class CredentialsAuthenticator(AbstractAuthenticator):
"""CredentialsAuthenticator """CredentialsAuthenticator.
Subclass of AbstractAuthenticator which provides authentication via Subclass of AbstractAuthenticator which provides authentication via
credentials (username/password). This class always needs a credentials (username/password). This class always needs a
......
...@@ -67,8 +67,8 @@ class CaosDBHTTPResponse(ABC): ...@@ -67,8 +67,8 @@ class CaosDBHTTPResponse(ABC):
def close(self): def close(self):
"""close. """close.
Close this response. Depending on the implementation this might also Close this response. Depending on the implementation this might
close underlying streams, sockets etc. also close underlying streams, sockets etc.
""" """
......
...@@ -164,8 +164,10 @@ def check_python_ssl_version(hexversion): ...@@ -164,8 +164,10 @@ def check_python_ssl_version(hexversion):
"\nPython 3 version is smaller than 3.2. It is not does not fully support SSL encryption. Please update your Python to 2.7.9 or greater, or 3.2 or greater." "\nPython 3 version is smaller than 3.2. It is not does not fully support SSL encryption. Please update your Python to 2.7.9 or greater, or 3.2 or greater."
) )
_PATTERN = re.compile(r"^SessionToken=([^;]*);.*$") _PATTERN = re.compile(r"^SessionToken=([^;]*);.*$")
def unquote(string): def unquote(string):
"""unquote. """unquote.
...@@ -177,6 +179,7 @@ def unquote(string): ...@@ -177,6 +179,7 @@ def unquote(string):
return bts.decode("utf-8") return bts.decode("utf-8")
return bts return bts
def parse_auth_token(cookie): def parse_auth_token(cookie):
"""parse_auth_token. """parse_auth_token.
...@@ -197,6 +200,7 @@ def parse_auth_token(cookie): ...@@ -197,6 +200,7 @@ def parse_auth_token(cookie):
auth_token = unquote(_PATTERN.split(cookie)[1]) auth_token = unquote(_PATTERN.split(cookie)[1])
return auth_token return auth_token
def auth_token_to_cookie(auth_token): def auth_token_to_cookie(auth_token):
"""auth_token_to_cookie. """auth_token_to_cookie.
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
# #
# ** end header # ** end header
# #
"""test_authentication_keyring """test_authentication_keyring.
Tests for the caosdb.connection.authentication.keyring module. Tests for the caosdb.connection.authentication.keyring module.
""" """
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
# #
# ** end header # ** end header
# #
"""test_authentication_pass """test_authentication_pass.
Tests for the caosdb.connection.authentication.pass module. Tests for the caosdb.connection.authentication.pass module.
""" """
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
# #
# ** end header # ** end header
# #
"""Test caosdb.connection.utils""" """Test caosdb.connection.utils."""
# pylint: disable=missing-docstring # pylint: disable=missing-docstring
from __future__ import unicode_literals, print_function from __future__ import unicode_literals, print_function
from pytest import raises from pytest import raises
...@@ -47,5 +47,6 @@ def setup_module(): ...@@ -47,5 +47,6 @@ def setup_module():
def test_parse_auth_token(): def test_parse_auth_token():
assert parse_auth_token("SessionToken=%5Bblablabla%5D; expires=bla; ...") == "[blablabla]" assert parse_auth_token("SessionToken=%5Bblablabla%5D; expires=bla; ...") == "[blablabla]"
def test_auth_token_to_cookie(): def test_auth_token_to_cookie():
assert auth_token_to_cookie("[blablabla]") == "SessionToken=%5Bblablabla%5D;" assert auth_token_to_cookie("[blablabla]") == "SessionToken=%5Bblablabla%5D;"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment