Skip to content

Commit

Permalink
Add freeze overwrite test
Browse files Browse the repository at this point in the history
  • Loading branch information
betoSolares committed Jul 30, 2020
1 parent 2ce6b45 commit 8825cd1
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,14 @@ def test_import_tmuxinator(cli_args, inputs, tmpdir, monkeypatch):
['\n', 'y\n', './la.yaml\n', 'y\n'],
),
(['freeze'], ['\n', 'y\n', './exists.yaml\n', './la.yaml\n', 'y\n']), # Exists
( # Create a new one
['freeze', 'mysession', '--force'],
['\n', 'y\n', './la.yaml\n', 'y\n']
),
( # Imply current session if not entered
['freeze', '--force'],
['\n', 'y\n', './la.yaml\n', 'y\n'],
),
],
)
def test_freeze(server, cli_args, inputs, tmpdir, monkeypatch):
Expand All @@ -508,6 +516,34 @@ def test_freeze(server, cli_args, inputs, tmpdir, monkeypatch):
assert tmpdir.join('la.yaml').check()


@pytest.mark.parametrize(
"cli_args,inputs",
[
( # Overwrite
['freeze', 'mysession', '--force'],
['\n', 'y\n', './exists.yaml\n', 'y\n'],
),
( # Imply current session if not entered
['freeze', '--force'],
['\n', 'y\n', './exists.yaml\n', 'y\n']
),
],
)
def test_freeze_overwrite(server, cli_args, inputs, tmpdir, monkeypatch):
monkeypatch.setenv('HOME', str(tmpdir))
tmpdir.join('exists.yaml').ensure()

server.new_session(session_name='mysession')

with tmpdir.as_cwd():
runner = CliRunner()
# Use tmux server (socket name) used in the test
cli_args = cli_args + ['-L', server.socket_name]
out = runner.invoke(cli.cli, cli_args, input=''.join(inputs))
print(out.output)
assert tmpdir.join('exists.yaml').check()


def test_get_abs_path(tmpdir):
expect = str(tmpdir)
with tmpdir.as_cwd():
Expand Down

0 comments on commit 8825cd1

Please sign in to comment.