From 34b8d8fcbf528f21ac7869685e33214af381265c Mon Sep 17 00:00:00 2001 From: Stefania Alborghetti Date: Fri, 23 Oct 2015 13:58:19 -0400 Subject: [PATCH] Make cqlsh tests work when authentication is configured Patch by stefania; reviewed by aholmberg for CASSANDRA-10544 --- pylib/cqlshlib/test/run_cqlsh.py | 2 +- pylib/cqlshlib/test/test_cqlsh_output.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pylib/cqlshlib/test/run_cqlsh.py b/pylib/cqlshlib/test/run_cqlsh.py index 88b0ca6a67..cc929e1f54 100644 --- a/pylib/cqlshlib/test/run_cqlsh.py +++ b/pylib/cqlshlib/test/run_cqlsh.py @@ -27,7 +27,7 @@ import math from time import time from . import basecase -DEFAULT_CQLSH_PROMPT = '\ncqlsh(:\S+)?> ' +DEFAULT_CQLSH_PROMPT = os.linesep + '(\S+@)?cqlsh(:\S+)?> ' DEFAULT_CQLSH_TERM = 'xterm' cqlshlog = basecase.cqlshlog diff --git a/pylib/cqlshlib/test/test_cqlsh_output.py b/pylib/cqlshlib/test/test_cqlsh_output.py index 64950e21d2..e3af8e820f 100644 --- a/pylib/cqlshlib/test/test_cqlsh_output.py +++ b/pylib/cqlshlib/test/test_cqlsh_output.py @@ -522,26 +522,26 @@ class TestCqlshOutput(BaseTestCase): def test_prompt(self): with testrun_cqlsh(tty=True, keyspace=None, cqlver=cqlsh.DEFAULT_CQLVER) as c: - self.assertEqual(c.output_header.splitlines()[-1], 'cqlsh> ') + self.assertTrue(c.output_header.splitlines()[-1].endswith('cqlsh> ')) c.send('\n') output = c.read_to_next_prompt().replace('\r\n', '\n') - self.assertEqual(output, '\ncqlsh> ') + self.assertTrue(output.endswith('cqlsh> ')) cmd = "USE \"%s\";\n" % get_test_keyspace().replace('"', '""') c.send(cmd) output = c.read_to_next_prompt().replace('\r\n', '\n') - self.assertEqual(output, '%scqlsh:%s> ' % (cmd, get_test_keyspace())) + self.assertTrue(output.endswith('cqlsh:%s> ' % (get_test_keyspace()))) c.send('use system;\n') output = c.read_to_next_prompt().replace('\r\n', '\n') - self.assertEqual(output, 'use system;\ncqlsh:system> ') + self.assertTrue(output.endswith('cqlsh:system> ')) c.send('use NONEXISTENTKEYSPACE;\n') outputlines = c.read_to_next_prompt().splitlines() self.assertEqual(outputlines[0], 'use NONEXISTENTKEYSPACE;') - self.assertEqual(outputlines[2], 'cqlsh:system> ') + self.assertTrue(outputlines[2].endswith('cqlsh:system> ')) midline = ColoredText(outputlines[1]) self.assertEqual(midline.plain(), 'InvalidRequest: code=2200 [Invalid query] message="Keyspace \'nonexistentkeyspace\' does not exist"')