Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
liyang committed Jan 25, 2025
1 parent 2ffd4ec commit 8f848c4
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,19 +308,26 @@ def test_sync(runner, testdir):
assert "newfile\n" in runner.invoke(ls, [str(testdir)]).output
assert "text\n" in runner.invoke(ls, [str(testdir)]).output

result = runner.invoke(
sync, ["-v", str(testdir / "text"), str(testdir / "newfile")]
)

assert result.exit_code == 0
assert "done" in result.output
assert "newfile\n" in runner.invoke(ls, [str(testdir)]).output
assert "text\n" in runner.invoke(ls, [str(testdir)]).output

runner.invoke(mkdir, [str(testdir / "newdir")])
result = runner.invoke(
sync, ["-g", str(testdir / "text"), str(testdir / "newdir" / "newfile")]
sync, [str(testdir / "text"), str(testdir / "newdir" / "newfile")]
)

assert result.exit_code == 0
assert "%" in result.output
assert "newfile\n" in runner.invoke(ls, [str(testdir / "newdir")]).output

runner.invoke(mkdir, [str(testdir / "newdir2")])
glob_result = runner.invoke(
sync, ["-g", str(testdir / "*"), str(testdir / "newdir2")]
)
glob_result = runner.invoke(sync, [str(testdir / "*"), str(testdir / "newdir2")])

assert glob_result.exit_code == 0
assert "%" in glob_result.output
Expand Down Expand Up @@ -350,12 +357,12 @@ def test_sync_progress_bar(runner, testdir, mocker):
pass

result = runner.invoke(
sync, ["-g", str(testdir / "large_dir"), str(testdir / "new_large_dir")]
sync, ["-v", str(testdir / "large_dir"), str(testdir / "new_large_dir")]
)

assert result.exit_code == 0
assert "building progress bar" in result.output
assert "building progress bar, find" in result.output
assert "100%" in result.output
assert result.output.count("done") == 2

runner.invoke(rm, [str(testdir / "large_dir")])
runner.invoke(rm, [str(testdir / "new_large_dir")])
Expand Down

0 comments on commit 8f848c4

Please sign in to comment.