summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-03-17 19:03:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-03-17 19:13:27 +0000
commitbd0dfb88fdf5714833466787fd73edaff9740a73 (patch)
treec53a5ef22f910c748c48a0e0d587755ec6f405b0 /tests
parentReleasing debian version 1.5.0-3. (diff)
downloadlitecli-bd0dfb88fdf5714833466787fd73edaff9740a73.tar.xz
litecli-bd0dfb88fdf5714833466787fd73edaff9740a73.zip
Merging upstream version 1.6.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/liteclirc1
-rw-r--r--tests/test_completion_engine.py4
-rw-r--r--tests/test_smart_completion_public_schema_only.py20
-rw-r--r--tests/test_sqlexecute.py19
4 files changed, 29 insertions, 15 deletions
diff --git a/tests/liteclirc b/tests/liteclirc
index e31942f..979b409 100644
--- a/tests/liteclirc
+++ b/tests/liteclirc
@@ -54,6 +54,7 @@ wider_completion_menu = False
# litecli prompt
# \D - The full current date
# \d - Database name
+# \f - File basename of the "main" database
# \m - Minutes of the current time
# \n - Newline
# \P - AM/PM
diff --git a/tests/test_completion_engine.py b/tests/test_completion_engine.py
index 84d5536..760f275 100644
--- a/tests/test_completion_engine.py
+++ b/tests/test_completion_engine.py
@@ -36,7 +36,9 @@ def test_order_by_suggests_cols_with_qualified_table_scope():
"SELECT * FROM sch.tabl ORDER BY ", "SELECT * FROM sch.tabl ORDER BY "
)
assert sorted_dicts(suggestions) == sorted_dicts(
- [{"type": "column", "tables": [("sch", "tabl", None)]},]
+ [
+ {"type": "column", "tables": [("sch", "tabl", None)]},
+ ]
)
diff --git a/tests/test_smart_completion_public_schema_only.py b/tests/test_smart_completion_public_schema_only.py
index ea5c580..e532118 100644
--- a/tests/test_smart_completion_public_schema_only.py
+++ b/tests/test_smart_completion_public_schema_only.py
@@ -367,15 +367,17 @@ def test_auto_escaped_col_names(completer, complete_event):
Document(text=text, cursor_position=position), complete_event
)
)
- assert result == [
- Completion(text="*", start_position=0),
- Completion(text="`ABC`", start_position=0),
- Completion(text="`insert`", start_position=0),
- Completion(text="id", start_position=0),
- ] + list(map(Completion, completer.functions)) + [
- Completion(text="`select`", start_position=0)
- ] + list(
- map(Completion, sorted(completer.keywords))
+ assert (
+ result
+ == [
+ Completion(text="*", start_position=0),
+ Completion(text="`ABC`", start_position=0),
+ Completion(text="`insert`", start_position=0),
+ Completion(text="id", start_position=0),
+ ]
+ + list(map(Completion, completer.functions))
+ + [Completion(text="`select`", start_position=0)]
+ + list(map(Completion, sorted(completer.keywords)))
)
diff --git a/tests/test_sqlexecute.py b/tests/test_sqlexecute.py
index 2dde4d4..029c64b 100644
--- a/tests/test_sqlexecute.py
+++ b/tests/test_sqlexecute.py
@@ -102,6 +102,17 @@ def test_unicode_support_in_output(executor):
@dbtest
+def test_invalid_unicode_values_dont_choke(executor):
+ run(executor, "create table unicodechars(t text)")
+ # \xc3 is not a valid utf-8 char. But we can insert it into the database
+ # which can break querying if not handled correctly.
+ run(executor, u"insert into unicodechars (t) values (cast(x'c3' as text))")
+
+ results = run(executor, u"select * from unicodechars")
+ assert_result_equal(results, headers=["t"], rows=[("\\xc3",)])
+
+
+@dbtest
def test_multiple_queries_same_line(executor):
results = run(executor, "select 'foo'; select 'bar'")
@@ -186,6 +197,7 @@ def test_bind_parameterized_favorite_query(executor):
with pytest.raises(ProgrammingError):
results = run(executor, "\\f+ q_param 1 2")
+
@dbtest
def test_verbose_feature_of_favorite_query(executor):
set_expanded_output(False)
@@ -198,11 +210,7 @@ def test_verbose_feature_of_favorite_query(executor):
results = run(executor, "\\f sh_param 1")
assert_result_equal(
- results,
- title=None,
- headers=["a", "id"],
- rows=[("abc", 1)],
- auto_status=False,
+ results, title=None, headers=["a", "id"], rows=[("abc", 1)], auto_status=False,
)
results = run(executor, "\\f+ sh_param 1")
@@ -214,6 +222,7 @@ def test_verbose_feature_of_favorite_query(executor):
auto_status=False,
)
+
@dbtest
def test_shell_parameterized_favorite_query(executor):
set_expanded_output(False)