1
1
mirror of https://github.com/dbcli/pgcli.git synced 2024-10-06 02:07:53 +03:00

Add tests for \c and \connect to suggest databases

This commit is contained in:
Darik Gamble 2015-08-05 14:32:35 -04:00
parent 100daebaae
commit 6a2771a9a2

View File

@ -1,3 +1,4 @@
import pytest
from pgcli.packages.sqlcompletion import suggest_type
from test_sqlcompletion import sorted_dicts
@ -67,4 +68,10 @@ def test_schema_qualified_dT_suggests_datatypes():
text = '\\dT foo.'
suggestions = suggest_type(text, text)
assert sorted_dicts(suggestions) == sorted_dicts(
[{'type': 'datatype', 'schema': 'foo'}])
[{'type': 'datatype', 'schema': 'foo'}])
@pytest.mark.parametrize('command', ['\\c ', '\\connect '])
def test_c_suggests_databases(command):
suggestions = suggest_type(command, command)
assert suggestions == [{'type': 'database'}]