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

STY: formatting

parent 63d72949
No related branches found
No related tags found
No related merge requests found
......@@ -21,8 +21,7 @@
#
# ** end header
#
"""external_credentials_provider.
"""
"""external_credentials_provider."""
from __future__ import absolute_import, unicode_literals
from abc import ABCMeta
import logging
......
......@@ -126,7 +126,7 @@ class AbstractAuthenticator(ABC):
def on_request(self, method, path, headers, **kwargs):
# pylint: disable=unused-argument
"""on_request
"""on_request.
A call-back which is to be called by the connection before each
request. This method set the auth cookie for that request.
......@@ -150,7 +150,7 @@ class AbstractAuthenticator(ABC):
class CredentialsAuthenticator(AbstractAuthenticator):
"""CredentialsAuthenticator
"""CredentialsAuthenticator.
Subclass of AbstractAuthenticator which provides authentication via
credentials (username/password). This class always needs a
......
......@@ -67,8 +67,8 @@ class CaosDBHTTPResponse(ABC):
def close(self):
"""close.
Close this response. Depending on the implementation this might also
close underlying streams, sockets etc.
Close this response. Depending on the implementation this might
also close underlying streams, sockets etc.
"""
......
......@@ -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."
)
_PATTERN = re.compile(r"^SessionToken=([^;]*);.*$")
def unquote(string):
"""unquote.
......@@ -177,6 +179,7 @@ def unquote(string):
return bts.decode("utf-8")
return bts
def parse_auth_token(cookie):
"""parse_auth_token.
......@@ -197,6 +200,7 @@ def parse_auth_token(cookie):
auth_token = unquote(_PATTERN.split(cookie)[1])
return auth_token
def auth_token_to_cookie(auth_token):
"""auth_token_to_cookie.
......
......@@ -21,7 +21,7 @@
#
# ** end header
#
"""test_authentication_keyring
"""test_authentication_keyring.
Tests for the caosdb.connection.authentication.keyring module.
"""
......
......@@ -21,7 +21,7 @@
#
# ** end header
#
"""test_authentication_pass
"""test_authentication_pass.
Tests for the caosdb.connection.authentication.pass module.
"""
......
......@@ -21,7 +21,7 @@
#
# ** end header
#
"""Test caosdb.connection.utils"""
"""Test caosdb.connection.utils."""
# pylint: disable=missing-docstring
from __future__ import unicode_literals, print_function
from pytest import raises
......@@ -47,5 +47,6 @@ def setup_module():
def test_parse_auth_token():
assert parse_auth_token("SessionToken=%5Bblablabla%5D; expires=bla; ...") == "[blablabla]"
def test_auth_token_to_cookie():
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