Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overwrite on freeze #618

Merged
merged 2 commits into from
Oct 12, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add freeze overwrite test
  • Loading branch information
betoSolares committed Aug 17, 2020
commit 551ed7794ea15d2d49f368352281dcaaf0cd2978
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