summaryrefslogtreecommitdiff
path: root/tests/test_utils.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-03-10 14:54:06 -0400
committerGitHub <noreply@github.com>2019-03-10 14:54:06 -0400
commitd9cd632651d01f87bd599feb75653cd0dde9497e (patch)
tree277bf52a39593799d919dc2bbb1dd054b514d448 /tests/test_utils.py
parent3c7361db4cc0cd2b0c8445902a1a3eed8b2ae225 (diff)
parent16a337dfa4b96d57f0dc9e2e31e2eb99330f673b (diff)
downloadcmd2-git-d9cd632651d01f87bd599feb75653cd0dde9497e.tar.gz
Merge pull request #642 from python-cmd2/store_output
StdSim.pause_storage
Diffstat (limited to 'tests/test_utils.py')
-rw-r--r--tests/test_utils.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 75d4479a..307f69da 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -194,3 +194,25 @@ def test_stdsim_getattr_noexist(stdout_sim):
# Here the StdSim getattr is allowing us to access methods defined by the inner stream
assert not stdout_sim.isatty()
+def test_stdsim_pause_storage(stdout_sim):
+ # Test pausing storage for string data
+ my_str = 'Hello World'
+
+ stdout_sim.pause_storage = False
+ stdout_sim.write(my_str)
+ assert stdout_sim.read() == my_str
+
+ stdout_sim.pause_storage = True
+ stdout_sim.write(my_str)
+ assert stdout_sim.read() == ''
+
+ # Test pausing storage for binary data
+ b_str = b'Hello World'
+
+ stdout_sim.pause_storage = False
+ stdout_sim.buffer.write(b_str)
+ assert stdout_sim.readbytes() == b_str
+
+ stdout_sim.pause_storage = True
+ stdout_sim.buffer.write(b_str)
+ assert stdout_sim.getbytes() == b''