Skip to content

Commit 0a64c3e

Browse files
committed
give toolbar tests the sqlexecute property
Now that the prompt string can have data fetched from the connection, and now that the toolbar can have custom format strings, there are assertions in get_prompt() that we should satisfy in toolbar tests, by setting the sqlexecute property.
1 parent 1051764 commit 0a64c3e

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Upcoming (TBD)
44
Internal
55
---------
66
* Require `sqlglot` 30.x.
7+
* Connect toolbar tests to the test database.
78

89

910
1.65.0 (2026/03/16)

test/test_clitoolbar.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,60 @@
1+
# type: ignore
2+
13
from prompt_toolkit.shortcuts import PromptSession
24

35
from mycli.clitoolbar import create_toolbar_tokens_func
46
from mycli.main import MyCli
7+
from mycli.sqlexecute import SQLExecute
8+
from test.utils import HOST, PASSWORD, PORT, USER, dbtest
59

610

11+
@dbtest
712
def test_create_toolbar_tokens_func_initial():
813
m = MyCli()
14+
m.sqlexecute = SQLExecute(
15+
None,
16+
USER,
17+
PASSWORD,
18+
HOST,
19+
PORT,
20+
None,
21+
None,
22+
None,
23+
None,
24+
None,
25+
None,
26+
None,
27+
None,
28+
None,
29+
None,
30+
)
931
m.prompt_app = PromptSession()
1032
iteration = 0
1133
f = create_toolbar_tokens_func(m, lambda: iteration == 0, m.toolbar_format)
1234
result = f()
1335
assert any("right-arrow accepts full-line suggestion" in token for token in result)
1436

1537

38+
@dbtest
1639
def test_create_toolbar_tokens_func_short():
1740
m = MyCli()
41+
m.sqlexecute = SQLExecute(
42+
None,
43+
USER,
44+
PASSWORD,
45+
HOST,
46+
PORT,
47+
None,
48+
None,
49+
None,
50+
None,
51+
None,
52+
None,
53+
None,
54+
None,
55+
None,
56+
None,
57+
)
1858
m.prompt_app = PromptSession()
1959
iteration = 1
2060
f = create_toolbar_tokens_func(m, lambda: iteration == 0, m.toolbar_format)

0 commit comments

Comments
 (0)