Skip to content

Commit 82cfc69

Browse files
pythopstony
authored andcommitted
Add tests for ls option
1 parent 3edfd2a commit 82cfc69

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

tests/test_cli.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import json
66
import os
7+
from pathlib import Path
78

89
import pytest
910

@@ -13,7 +14,13 @@
1314
import libtmux
1415
from libtmux.common import has_lt_version
1516
from tmuxp import cli, config
16-
from tmuxp.cli import get_config_dir, is_pure_name, load_workspace, scan_config
17+
from tmuxp.cli import (
18+
command_ls,
19+
get_config_dir,
20+
is_pure_name,
21+
load_workspace,
22+
scan_config,
23+
)
1724

1825
from .fixtures._util import curjoin, loadfixture
1926

@@ -574,3 +581,15 @@ def check_cmd(config_arg):
574581
assert str(user_config) in check_cmd(str(configdir.join('myconfig.yaml')))
575582

576583
assert 'file not found' in check_cmd('.tmuxp.json')
584+
585+
def test_ls_cli(monkeypatch, tmpdir):
586+
tmpdir.join('.tmuxp/session_1.yaml').ensure()
587+
tmpdir.join('.tmuxp/session_2.yaml').ensure()
588+
tmpdir.join('.tmuxp/session_3.json').ensure()
589+
590+
monkeypatch.setenv("HOME", str(tmpdir))
591+
592+
runner = CliRunner()
593+
594+
cli_output = runner.invoke(command_ls).output
595+
assert cli_output == "session_1\nsession_2\nsession_3\n"

0 commit comments

Comments
 (0)