summaryrefslogtreecommitdiffstats
path: root/test/test_main.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-02-08 11:28:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-02-08 11:28:55 +0000
commit12ffec7e2e719776343027f9fbdd0d070d3ff68c (patch)
tree6eeb1a166346e9f319fd3056974c5783d3428506 /test/test_main.py
parentAdding debian version 1.22.2-0.1. (diff)
downloadmycli-12ffec7e2e719776343027f9fbdd0d070d3ff68c.tar.xz
mycli-12ffec7e2e719776343027f9fbdd0d070d3ff68c.zip
Merging upstream version 1.23.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/test_main.py')
-rw-r--r--test/test_main.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/test_main.py b/test/test_main.py
index 3f92bd1..707c359 100644
--- a/test/test_main.py
+++ b/test/test_main.py
@@ -492,3 +492,37 @@ def test_ssh_config(monkeypatch):
MockMyCli.connect_args["ssh_host"] == "arg_host" and \
MockMyCli.connect_args["ssh_port"] == 3 and \
MockMyCli.connect_args["ssh_key_filename"] == "/path/to/key"
+
+
+@dbtest
+def test_init_command_arg(executor):
+ init_command = "set sql_select_limit=1000"
+ sql = 'show variables like "sql_select_limit";'
+ runner = CliRunner()
+ result = runner.invoke(
+ cli, args=CLI_ARGS + ["--init-command", init_command], input=sql
+ )
+
+ expected = "sql_select_limit\t1000\n"
+ assert result.exit_code == 0
+ assert expected in result.output
+
+
+@dbtest
+def test_init_command_multiple_arg(executor):
+ init_command = 'set sql_select_limit=2000; set max_join_size=20000'
+ sql = (
+ 'show variables like "sql_select_limit";\n'
+ 'show variables like "max_join_size"'
+ )
+ runner = CliRunner()
+ result = runner.invoke(
+ cli, args=CLI_ARGS + ['--init-command', init_command], input=sql
+ )
+
+ expected_sql_select_limit = 'sql_select_limit\t2000\n'
+ expected_max_join_size = 'max_join_size\t20000\n'
+
+ assert result.exit_code == 0
+ assert expected_sql_select_limit in result.output
+ assert expected_max_join_size in result.output