summaryrefslogtreecommitdiffstats
path: root/test/test_special_iocommands.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-02-08 11:28:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-02-08 11:28:51 +0000
commit08cfba7d158632e4132e0cd8db31f9f3d2f541f0 (patch)
tree8f4d83701ee1eda863677685a1198a2a93dc94f0 /test/test_special_iocommands.py
parentAdding upstream version 1.22.2. (diff)
downloadmycli-08cfba7d158632e4132e0cd8db31f9f3d2f541f0.tar.xz
mycli-08cfba7d158632e4132e0cd8db31f9f3d2f541f0.zip
Adding upstream version 1.23.2.upstream/1.23.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/test_special_iocommands.py')
-rw-r--r--test/test_special_iocommands.py25
1 files changed, 20 insertions, 5 deletions
diff --git a/test/test_special_iocommands.py b/test/test_special_iocommands.py
index b8b3acb..73bfbab 100644
--- a/test/test_special_iocommands.py
+++ b/test/test_special_iocommands.py
@@ -49,7 +49,8 @@ def test_editor_command():
assert mycli.packages.special.get_filename(r'\e filename') == "filename"
os.environ['EDITOR'] = 'true'
- mycli.packages.special.open_external_editor(r'select 1') == "select 1"
+ os.environ['VISUAL'] = 'true'
+ mycli.packages.special.open_external_editor(sql=r'select 1') == "select 1"
def test_tee_command():
@@ -93,9 +94,8 @@ def test_once_command():
with pytest.raises(TypeError):
mycli.packages.special.execute(None, u"\\once")
- mycli.packages.special.execute(None, u"\\once /proc/access-denied")
with pytest.raises(OSError):
- mycli.packages.special.write_once(u"hello world")
+ mycli.packages.special.execute(None, u"\\once /proc/access-denied")
mycli.packages.special.write_once(u"hello world") # write without file set
with tempfile.NamedTemporaryFile() as f:
@@ -104,9 +104,24 @@ def test_once_command():
assert f.read() == b"hello world\n"
mycli.packages.special.execute(None, u"\\once -o " + f.name)
- mycli.packages.special.write_once(u"hello world")
+ mycli.packages.special.write_once(u"hello world line 1")
+ mycli.packages.special.write_once(u"hello world line 2")
f.seek(0)
- assert f.read() == b"hello world\n"
+ assert f.read() == b"hello world line 1\nhello world line 2\n"
+
+
+def test_pipe_once_command():
+ with pytest.raises(IOError):
+ mycli.packages.special.execute(None, u"\\pipe_once")
+
+ with pytest.raises(OSError):
+ mycli.packages.special.execute(
+ None, u"\\pipe_once /proc/access-denied")
+
+ mycli.packages.special.execute(None, u"\\pipe_once wc")
+ mycli.packages.special.write_once(u"hello world")
+ mycli.packages.special.unset_pipe_once_if_written()
+ # how to assert on wc output?
def test_parseargfile():