Skip to content

Commit b10d1f8

Browse files
committed
improve startup banner/tips test coverage
1 parent 7f25681 commit b10d1f8

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

test/pytests/test_main_modes_repl.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,19 @@ def test_repl_show_startup_banner_and_prompt_helpers(monkeypatch: pytest.MonkeyP
359359
assert repl_mode._get_continuation(cli, 4, 0, 0) == [('class:continuation', ' ')]
360360

361361

362+
def test_repl_show_startup_banner_thanks_sponsor(monkeypatch: pytest.MonkeyPatch) -> None:
363+
cli = make_repl_cli(SimpleNamespace(server_info='Server'))
364+
cli.less_chatty = False
365+
printed: list[str] = []
366+
monkeypatch.setattr(builtins, 'print', lambda *args, **kwargs: printed.append(' '.join(str(x) for x in args)))
367+
monkeypatch.setattr(repl_mode.random, 'random', lambda: 0.25)
368+
monkeypatch.setattr(repl_mode, '_sponsors_picker', lambda: 'Carol')
369+
370+
repl_mode._show_startup_banner(cli, cli.sqlexecute)
371+
372+
assert any('Thanks to the sponsor' in line and 'Carol' in line for line in printed)
373+
374+
362375
def test_prompt_toolbar_and_title_helpers(monkeypatch: pytest.MonkeyPatch) -> None:
363376
class PromptCursor:
364377
def __enter__(self) -> 'PromptCursor':

0 commit comments

Comments
 (0)