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

STY: just formatting (mainly spaces)

parent 8233fa38
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,7 @@ from .plain import PlainTextCredentialsProvider ...@@ -31,6 +31,7 @@ from .plain import PlainTextCredentialsProvider
# meta class compatible with Python 2 *and* 3: # meta class compatible with Python 2 *and* 3:
ABC = ABCMeta(str('ABC'), (object, ), {str('__slots__'): ()}) ABC = ABCMeta(str('ABC'), (object, ), {str('__slots__'): ()})
class ExternalCredentialsProvider(PlainTextCredentialsProvider, ABC): class ExternalCredentialsProvider(PlainTextCredentialsProvider, ABC):
"""ExternalCredentialsProvider. """ExternalCredentialsProvider.
......
...@@ -144,7 +144,6 @@ class AbstractAuthenticator(ABC): ...@@ -144,7 +144,6 @@ class AbstractAuthenticator(ABC):
headers['Cookie'] = self._session_token headers['Cookie'] = self._session_token
class CredentialsAuthenticator(AbstractAuthenticator): class CredentialsAuthenticator(AbstractAuthenticator):
"""CredentialsAuthenticator """CredentialsAuthenticator
......
...@@ -32,6 +32,7 @@ class CaosDBException(Exception): ...@@ -32,6 +32,7 @@ class CaosDBException(Exception):
Exception.__init__(self, msg) Exception.__init__(self, msg)
self.msg = msg self.msg = msg
class ConfigurationException(CaosDBException): class ConfigurationException(CaosDBException):
"""ConfigurationException. """ConfigurationException.
...@@ -48,6 +49,7 @@ class ConfigurationException(CaosDBException): ...@@ -48,6 +49,7 @@ class ConfigurationException(CaosDBException):
msg : str msg : str
A description of the misconfiguration. A description of the misconfiguration.
""" """
def __init__(self, msg): def __init__(self, msg):
super(ConfigurationException, self).__init__(msg + super(ConfigurationException, self).__init__(msg +
ConfigurationException._INFO) ConfigurationException._INFO)
......
...@@ -10,9 +10,11 @@ from caosdb.connection.authentication import ( ...@@ -10,9 +10,11 @@ from caosdb.connection.authentication import (
external_credentials_provider as ecp external_credentials_provider as ecp
) )
class _TestCaller(ecp.ExternalCredentialsProvider): class _TestCaller(ecp.ExternalCredentialsProvider):
pass pass
def test_callback(): def test_callback():
def _callback(**config): def _callback(**config):
assert "opt" in config assert "opt" in config
...@@ -21,6 +23,7 @@ def test_callback(): ...@@ -21,6 +23,7 @@ def test_callback():
t.configure(opt=None) t.configure(opt=None)
assert t.password == "secret" assert t.password == "secret"
def test_log_password_incident(): def test_log_password_incident():
class _mylogger(logging.Logger): class _mylogger(logging.Logger):
def log(self, level, msg, *args, **kwargs): def log(self, level, msg, *args, **kwargs):
......
...@@ -29,6 +29,7 @@ import sys ...@@ -29,6 +29,7 @@ import sys
from pytest import raises from pytest import raises
from caosdb.connection.authentication.keyring import KeyringCaller from caosdb.connection.authentication.keyring import KeyringCaller
def test_initialization(): def test_initialization():
def _callback(**config): def _callback(**config):
assert not config assert not config
......
...@@ -27,10 +27,11 @@ Tests for the caosdb.connection.authentication.pass module. ...@@ -27,10 +27,11 @@ Tests for the caosdb.connection.authentication.pass module.
""" """
import sys import sys
from pytest import raises from pytest import raises
_PASSCALLER="caosdb.connection.authentication.pass" _PASSCALLER = "caosdb.connection.authentication.pass"
__import__(_PASSCALLER) __import__(_PASSCALLER)
PassCaller = sys.modules[_PASSCALLER].PassCaller PassCaller = sys.modules[_PASSCALLER].PassCaller
def test_initialization(): def test_initialization():
def _callback(**config): def _callback(**config):
assert not config assert not config
......
...@@ -30,6 +30,7 @@ from __future__ import unicode_literals ...@@ -30,6 +30,7 @@ from __future__ import unicode_literals
from pytest import raises from pytest import raises
from caosdb.connection.authentication.plain import PlainTextCredentialsProvider from caosdb.connection.authentication.plain import PlainTextCredentialsProvider
def test_subclass_configure(): def test_subclass_configure():
"""Test the correct passing of the password argument.""" """Test the correct passing of the password argument."""
class SubClassOf(PlainTextCredentialsProvider): class SubClassOf(PlainTextCredentialsProvider):
...@@ -53,6 +54,7 @@ def test_subclass_configure(): ...@@ -53,6 +54,7 @@ def test_subclass_configure():
assert exc_info.value.args[0] == ("configure() got multiple values for " assert exc_info.value.args[0] == ("configure() got multiple values for "
"keyword argument 'password'") "keyword argument 'password'")
def test_plain_has_logger(): def test_plain_has_logger():
p = PlainTextCredentialsProvider() p = PlainTextCredentialsProvider()
assert hasattr(p, "logger") assert hasattr(p, "logger")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment