From 309379ab1e5bb48a654dbd8c5789306ad9205fb8 Mon Sep 17 00:00:00 2001 From: Joerg Steffens Date: Thu, 12 Dec 2019 17:48:53 +0100 Subject: [PATCH] systemtests (python-bareos-test): add test test_login_tls_tls_fixedprotocolversion --- .../python-bareos-unittest.py | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/systemtests/tests/python-bareos-test/python-bareos-unittest.py b/systemtests/tests/python-bareos-test/python-bareos-unittest.py index 88025ba457b..498d2064dd1 100755 --- a/systemtests/tests/python-bareos-test/python-bareos-unittest.py +++ b/systemtests/tests/python-bareos-test/python-bareos-unittest.py @@ -445,7 +445,7 @@ def test_login_notls_tls(self): self.assertFalse(hasattr(director.socket, 'cipher')) - def test_login_notls_tls_fixprotocolversion(self): + def test_login_notls_tls_fixedprotocolversion(self): ''' console: notls, director: tls => nologin @@ -523,6 +523,34 @@ def test_login_tls_tls(self): logger.debug(str(cipher)) + @unittest.skipUnless(bareos.bsock.DirectorConsole.is_tls_psk_available(), + "TLS-PSK is not available.") + def test_login_tls_tls_fixedprotocolversion(self): + ''' + console: tls, director: tls => login + ''' + + logger = logging.getLogger() + + username = self.get_operator_username(tls=True) + password = self.get_operator_password(username) + + director = bareos.bsock.DirectorConsole( + address=self.director_address, + port=self.director_port, + protocolversion=ProtocolVersions.last, + tls_psk_require=True, + name=username, + password=password) + + whoami = director.call('whoami').decode('utf-8') + self.assertEqual(username, whoami.rstrip()) + + self.assertTrue(hasattr(director.socket, 'cipher')) + cipher = director.socket.cipher() + logger.debug(str(cipher)) + + # # Test with JSON backend