[X2Go-Commits] [x2gobroker] 01/02: x2gobroker/tests/test_web_plain_base.py: Add test case for passwords with accentuated characters (using the testsuite_authmech for now).

git-admin at x2go.org git-admin at x2go.org
Mon Feb 12 21:21:04 CET 2018


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2gobroker.

commit 8ed1989b297ffe8ae48e7a86a50e11ae4c3917ea
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Mon Feb 12 21:19:38 2018 +0100

    x2gobroker/tests/test_web_plain_base.py: Add test case for passwords with accentuated characters (using the testsuite_authmech for now).
---
 debian/changelog                           |  2 ++
 x2gobroker/authmechs/testsuite_authmech.py |  5 ++++-
 x2gobroker/tests/test_web_plain_base.py    | 21 +++++++++++++++++++++
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 116897b..46cf7ec 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,8 @@ x2gobroker (0.0.4.0-0x2go1) UNRELEASED; urgency=medium
       deny-allow should actually work.
     - x2gobroker/brokers/base_broker.py: Entire rewrite of
       check_profile_acls() method. (Fixes: #1234).
+    - x2gobroker/tests/test_web_plain_base.py: Add test case for passwords
+      with accentuated characters (using the testsuite_authmech for now).
   * debian/{control,compat}: Bump to DH version level 9.
   * debian/{control,x2gobroker-common.install}:
     + Split out common files into non-Pythonian bin:pkg.
diff --git a/x2gobroker/authmechs/testsuite_authmech.py b/x2gobroker/authmechs/testsuite_authmech.py
index 4c36f6a..7063e81 100644
--- a/x2gobroker/authmechs/testsuite_authmech.py
+++ b/x2gobroker/authmechs/testsuite_authmech.py
@@ -24,5 +24,8 @@ class X2GoBrokerAuthMech(object):
         # return C{True} for user test with password sweet... (used by the unit tests)
         if username == 'test' and password == 'sweet':
             return True
-        return False
 
+        if username == "jacques" and password == 'thérèse':
+            return True
+
+        return False
diff --git a/x2gobroker/tests/test_web_plain_base.py b/x2gobroker/tests/test_web_plain_base.py
index 10ceb49..b4d5424 100644
--- a/x2gobroker/tests/test_web_plain_base.py
+++ b/x2gobroker/tests/test_web_plain_base.py
@@ -83,6 +83,27 @@ auth-mech = testsuite
         r.mustcontain('Access granted')
         x2gobroker.defaults.X2GOBROKER_CONFIG = _cf_bak
 
+    ### TEST RESPONSE: simple authentication with accentuated chars in password (check_access)
+
+    def test_checkaccess(self):
+        testApp = TestApp(application)
+        r = testApp.get('/plain/base/', expect_errors=True)
+        assert_equal(r.status, 404)
+        _config = """
+[broker_base]
+enable = true
+auth-mech = testsuite
+"""
+        tf = tempfile.NamedTemporaryFile(mode='w')
+        tf.write(_config)
+        tf.seek(0)
+        _cf_bak = x2gobroker.defaults.X2GOBROKER_CONFIG
+        x2gobroker.defaults.X2GOBROKER_CONFIG = tf.name
+        r = testApp.get('/plain/base/', params={'user': 'jacques', 'password': 'thérèse', }, expect_errors=True)
+        assert_equal(r.status, 200)
+        r.mustcontain('Access granted')
+        x2gobroker.defaults.X2GOBROKER_CONFIG = _cf_bak
+
     ### TEST TASK: listsessions (nothing should be returned for the base backend)
 
     def test_listsessions(self):

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git


More information about the x2go-commits mailing list