diff --git a/tox.ini b/tox.ini index f9776382db0770e3efe1b2711f50bb5b3adde1ec..94c2dc8affb280d3e7f6cff4536636432c9f7749 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist=py36, py37, py38 +envlist=py36, py37, py38, py39 skip_missing_interpreters = true [testenv] diff --git a/unittests/test_authentication_plain.py b/unittests/test_authentication_plain.py index 26c57e953f28a2a0ab80e35026c27ff74f18d370..1b7cbf0cd9a61b6ddadf54f908b25a82d87efa42 100644 --- a/unittests/test_authentication_plain.py +++ b/unittests/test_authentication_plain.py @@ -27,8 +27,9 @@ Unit tests for the modul caosdb.connection.authentication.plain. """ from __future__ import unicode_literals -from pytest import raises + from caosdb.connection.authentication.plain import PlainTextCredentialsProvider +from pytest import raises def test_subclass_configure(): @@ -51,8 +52,8 @@ def test_subclass_configure(): with raises(TypeError) as exc_info: instance.configure(password="OH NO!") - assert exc_info.value.args[0] == ("configure() got multiple values for " - "keyword argument 'password'") + assert exc_info.value.args[0].endswith("configure() got multiple values for " + "keyword argument 'password'") def test_plain_has_logger(): diff --git a/unittests/test_connection.py b/unittests/test_connection.py index 5c1518c65b51087ace514ca26fa77eff53130c73..60f1b73584f06f3e691ecbf52303906366e96fc0 100644 --- a/unittests/test_connection.py +++ b/unittests/test_connection.py @@ -23,23 +23,27 @@ # """Test caosdb.connection.""" # pylint: disable=missing-docstring -from __future__ import unicode_literals, print_function -from builtins import bytes, str # pylint: disable=redefined-builtin +from __future__ import print_function, unicode_literals + import re -from pytest import raises -from nose.tools import (assert_equal as eq, assert_raises as raiz, assert_true - as tru, assert_is_not_none as there, assert_false as - falz) -from caosdb.exceptions import ConfigurationException, LoginFailedException -from caosdb.connection.utils import urlencode, make_uri_path, quote -from caosdb.connection.connection import ( - configure_connection, CaosDBServerConnection, - _DefaultCaosDBServerConnection) -from caosdb.connection.mockup import (MockUpServerConnection, MockUpResponse, - _request_log_message) -from caosdb.configuration import get_config, _reset_config -from caosdb.connection.authentication.interface import CredentialsAuthenticator +from builtins import bytes, str # pylint: disable=redefined-builtin + from caosdb import execute_query +from caosdb.configuration import _reset_config, get_config +from caosdb.connection.authentication.interface import CredentialsAuthenticator +from caosdb.connection.connection import (CaosDBServerConnection, + _DefaultCaosDBServerConnection, + configure_connection) +from caosdb.connection.mockup import (MockUpResponse, MockUpServerConnection, + _request_log_message) +from caosdb.connection.utils import make_uri_path, quote, urlencode +from caosdb.exceptions import ConfigurationException, LoginFailedException +from nose.tools import assert_equal as eq +from nose.tools import assert_false as falz +from nose.tools import assert_is_not_none as there +from nose.tools import assert_raises as raiz +from nose.tools import assert_true as tru +from pytest import raises def setup_module(): @@ -96,6 +100,7 @@ def test_configure_connection(): get_config().add_section("Connection") get_config().set("Connection", "url", "https://host.de") get_config().set("Connection", "username", "test_username") + get_config().set("Connection", "password_method", "plain") get_config().set("Connection", "password", "test_password") get_config().set("Connection", "timeout", "200") diff --git a/unittests/test_entity.py b/unittests/test_entity.py index d877e1ab7267977a7e73d65033d6f02c16ea5521..e98dfbef5b6b5e5f691e8aecc2fa7d4a86991452 100644 --- a/unittests/test_entity.py +++ b/unittests/test_entity.py @@ -35,6 +35,7 @@ class TestEntity(unittest.TestCase): def setUp(self): self.assertIsNotNone(Entity) configure_connection(url="unittests", username="testuser", + password_method="plain", password="testpassword", timeout=200, implementation=MockUpServerConnection) diff --git a/unittests/test_file.py b/unittests/test_file.py index 957c578062b25c74547b599a25802938b057a2e0..3c80af7f362a7cdabe0a9ebc89cd2986d04fe242 100644 --- a/unittests/test_file.py +++ b/unittests/test_file.py @@ -22,16 +22,18 @@ # ** end header # """Tests for the File class.""" -# pylint: disable=missing-docstring -from nose.tools import (assert_is_not_none as there, assert_true as tru, - assert_equal as eq) -from caosdb import Record, File, configure_connection +from caosdb import File, Record, configure_connection from caosdb.connection.mockup import MockUpServerConnection +# pylint: disable=missing-docstring +from nose.tools import assert_equal as eq +from nose.tools import assert_is_not_none as there +from nose.tools import assert_true as tru def setup_module(): there(File) configure_connection(url="unittests", username="testuser", + password_method="plain", password="testpassword", timeout=200, implementation=MockUpServerConnection) diff --git a/unittests/test_record_type.py b/unittests/test_record_type.py index c105220c53579537994648b2f9bae5b4d378be13..f31c56decfc394211940296babc83200a470cc8a 100644 --- a/unittests/test_record_type.py +++ b/unittests/test_record_type.py @@ -22,16 +22,18 @@ # ** end header # """Tests for the RecordType class.""" -# pylint: disable=missing-docstring -from nose.tools import (assert_is_not_none as there, assert_true as tru, - assert_equal as eq) from caosdb import Entity, RecordType, configure_connection from caosdb.connection.mockup import MockUpServerConnection +# pylint: disable=missing-docstring +from nose.tools import assert_equal as eq +from nose.tools import assert_is_not_none as there +from nose.tools import assert_true as tru def setup_module(): there(RecordType) configure_connection(url="unittests", username="testuser", + password_method="plain", password="testpassword", timeout=200, implementation=MockUpServerConnection)