summaryrefslogtreecommitdiff
path: root/heatclient/tests
diff options
context:
space:
mode:
authorJoe Borg <joe@josephb.org>2017-07-25 15:30:02 +0100
committerJoe Borg <joe@josephb.org>2017-07-26 19:20:33 +0100
commitb45c792f95006987d19b8a97c553573327979700 (patch)
tree0fb5ccb73ac2122dd1b6dd392b36eab0f57df1bb /heatclient/tests
parent6462e5183fd45c94d91e168c709959af4e6782ef (diff)
downloadpython-heatclient-b45c792f95006987d19b8a97c553573327979700.tar.gz
Fixing read before prompt bug
Due to Python buffering sys.stdin and sys.stdout, the read can be shown before text prompt. Change-Id: I86d9ec62f7791da276585ce74a48162315effa7b Signed-off-by: Joe Borg <joe@josephb.org>
Diffstat (limited to 'heatclient/tests')
-rw-r--r--heatclient/tests/unit/test_shell.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/heatclient/tests/unit/test_shell.py b/heatclient/tests/unit/test_shell.py
index b9ec014..57bd1ff 100644
--- a/heatclient/tests/unit/test_shell.py
+++ b/heatclient/tests/unit/test_shell.py
@@ -2067,6 +2067,7 @@ class ShellTestUserPass(ShellBase):
mock_stdin.isatty.return_value = True
mock_stdin.readline = mock.Mock()
mock_stdin.readline.return_value = 'n'
+ mock_stdin.fileno.return_value = 0
sys.stdin = mock_stdin
self.mock_request_delete('/stacks/teststack2/2', None)
@@ -2078,7 +2079,7 @@ class ShellTestUserPass(ShellBase):
self.assertEqual(resp_text, resp)
self.m.ReplayAll()
- mock_stdin.readline.return_value = 'Y'
+ mock_stdin.readline.return_value = 'y'
resp = self.shell('stack-delete teststack2/2')
msg = 'Request to delete stack teststack2/2 has been accepted.'
self.assertRegex(resp, msg)
@@ -2093,6 +2094,7 @@ class ShellTestUserPass(ShellBase):
mock_stdin.isatty.return_value = True
mock_stdin.readline = mock.Mock()
mock_stdin.readline.return_value = ''
+ mock_stdin.fileno.return_value = 0
sys.stdin = mock_stdin
self.mock_request_delete('/stacks/teststack2/2')