summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDarik Gamble <darik.gamble@gmail.com>2015-01-26 08:30:55 -0500
committerDarik Gamble <darik.gamble@gmail.com>2015-01-26 08:30:55 -0500
commit7d3f276e8330854e0153d25e02df1b103529e640 (patch)
treef848058be82459117b0b54ab6e4e56767b966889 /tests
parent3abfde4003abbde943f960a99211931a8f95b04b (diff)
Fix \d special command and add some tests
Diffstat (limited to 'tests')
-rw-r--r--tests/test_pgspecial.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_pgspecial.py b/tests/test_pgspecial.py
index e69de29b..f02efac9 100644
--- a/tests/test_pgspecial.py
+++ b/tests/test_pgspecial.py
@@ -0,0 +1,19 @@
+from pgcli.packages.sqlcompletion import suggest_type
+from test_sqlcompletion import sorted_dicts
+
+def test_d_suggests_tables_and_schemas():
+ suggestions = suggest_type('\d ', '\d ')
+ assert sorted_dicts(suggestions) == sorted_dicts([
+ {'type': 'schema'}, {'type': 'table', 'schema': []}])
+
+ suggestions = suggest_type('\d xxx', '\d xxx')
+ assert sorted_dicts(suggestions) == sorted_dicts([
+ {'type': 'schema'}, {'type': 'table', 'schema': []}])
+
+def test_d_dot_suggests_schema_qualified_tables():
+ suggestions = suggest_type('\d myschema.', '\d myschema.')
+ assert suggestions == [{'type': 'table', 'schema': 'myschema'}]
+
+ suggestions = suggest_type('\d myschema.xxx', '\d myschema.xxx')
+ assert suggestions == [{'type': 'table', 'schema': 'myschema'}]
+