forked from cfperez/ipython-sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_parse.py
More file actions
26 lines (21 loc) · 1003 Bytes
/
Copy pathtest_parse.py
File metadata and controls
26 lines (21 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from sql.parse import parse
from six.moves import configparser
from IPython.config.configurable import Configurable
empty_config = Configurable()
def test_parse_no_sql():
assert parse("will:longliveliz@localhost/shakes", empty_config) == \
{'connection': "will:longliveliz@localhost/shakes",
'sql': ''}
def test_parse_with_sql():
assert parse("postgresql://will:longliveliz@localhost/shakes SELECT * FROM work",
empty_config) == \
{'connection': "postgresql://will:longliveliz@localhost/shakes",
'sql': 'SELECT * FROM work'}
def test_parse_sql_only():
assert parse("SELECT * FROM work", empty_config) == \
{'connection': "",
'sql': 'SELECT * FROM work'}
def test_parse_postgresql_socket_connection():
assert parse("postgresql:///shakes SELECT * FROM work", empty_config) == \
{'connection': "postgresql:///shakes",
'sql': 'SELECT * FROM work'}