From 2eee3ff3557a757ad62f5172b8692fbb036ca8ad Mon Sep 17 00:00:00 2001
From: Timm Fitschen <mail@timmfitschen.de>
Date: Thu, 11 Oct 2018 21:22:19 +0200
Subject: [PATCH] TST: Test the correct passing of the password arg.

---
 unittests/test_authentication_plain.py | 54 ++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 unittests/test_authentication_plain.py

diff --git a/unittests/test_authentication_plain.py b/unittests/test_authentication_plain.py
new file mode 100644
index 00000000..5e9c3c3d
--- /dev/null
+++ b/unittests/test_authentication_plain.py
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+#
+# ** header v3.0
+# This file is a part of the CaosDB Project.
+#
+# Copyright (C) 2018 Research Group Biomedical Physics,
+# Max-Planck-Institute for Dynamics and Self-Organization Göttingen
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+# ** end header
+#
+"""test_authentication_plain.
+
+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
+
+def test_subclass_configure():
+    """Test the correct passing of the password argument."""
+    class SubClassOf(PlainTextCredentialsProvider):
+        """A simple subclass of PlainTextCredentialsProvider."""
+
+        def configure(self, **config):
+            super(SubClassOf, self).configure(password="added in subclass", **config)
+
+    instance = SubClassOf()
+    instance.configure()
+    assert instance.password == "added in subclass"
+
+    instance.configure(**{"somearg": "BLA"})
+    assert instance.password == "added in subclass"
+
+    instance.configure(somearg="BLA")
+    assert instance.password == "added in subclass"
+
+    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'")
-- 
GitLab