Skip to content

Commit 7956070

Browse files
committed
✅ Add test for tmuxp freeze
1 parent bb984dd commit 7956070

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

tests/test_cli.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,55 @@ def test_import_tmuxinator(cli_args, inputs, tmpdir, monkeypatch):
472472
assert tmpdir.join('la.yaml').check()
473473

474474

475+
@pytest.mark.parametrize(
476+
"cli_args,inputs",
477+
[
478+
(['freeze', 'mysession'], ['\n', 'y\n', './la.yaml\n', './la.yaml\n', 'y\n']),
479+
( # Exists
480+
['freeze', 'mysession'],
481+
[
482+
'\n',
483+
'y\n',
484+
'./exists.yaml\n',
485+
'./exists.yaml\n',
486+
'./la.yaml\n',
487+
'./la.yaml\n',
488+
'y\n',
489+
],
490+
),
491+
( # Imply current session if not entered
492+
['freeze'],
493+
['\n', 'y\n', './la.yaml\n', './la.yaml\n', 'y\n'],
494+
),
495+
(
496+
['freeze'],
497+
[
498+
'\n',
499+
'y\n',
500+
'./exists.yaml\n',
501+
'./exists.yaml\n',
502+
'./la.yaml\n',
503+
'./la.yaml\n',
504+
'y\n',
505+
],
506+
), # Exists
507+
],
508+
)
509+
def test_freeze(server, cli_args, inputs, tmpdir, monkeypatch):
510+
monkeypatch.setenv('HOME', str(tmpdir))
511+
tmpdir.join('exists.yaml').ensure()
512+
513+
server.new_session(session_name='mysession')
514+
515+
with tmpdir.as_cwd():
516+
runner = CliRunner()
517+
# Use tmux server (socket name) used in the test
518+
cli_args = cli_args + ['-L', server.socket_name]
519+
out = runner.invoke(cli.cli, cli_args, input=''.join(inputs))
520+
print(out.output)
521+
assert tmpdir.join('la.yaml').check()
522+
523+
475524
def test_get_abs_path(tmpdir):
476525
expect = str(tmpdir)
477526
with tmpdir.as_cwd():

0 commit comments

Comments
 (0)