update
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
"""Tests for zsh completion."""
|
||||
|
||||
import subprocess
|
||||
|
||||
from flow.commands.completion import complete
|
||||
|
||||
|
||||
@@ -23,6 +25,33 @@ def test_complete_dotfiles_subcommands():
|
||||
assert "link" in result
|
||||
assert "unlink" in result
|
||||
assert "status" in result
|
||||
assert "edit" in result
|
||||
assert "repos" in result
|
||||
# Removed commands should not appear
|
||||
assert "sync" not in result
|
||||
assert "relink" not in result
|
||||
assert "undo" not in result
|
||||
assert "clean" not in result
|
||||
assert "modules" not in result
|
||||
|
||||
|
||||
def test_complete_dotfiles_repos_subcommands():
|
||||
result = complete(["flow", "dotfiles", "repos", ""], 3)
|
||||
assert "list" in result
|
||||
assert "status" in result
|
||||
assert "pull" in result
|
||||
assert "push" in result
|
||||
|
||||
|
||||
def test_complete_dotfiles_repos_pull_flags():
|
||||
result = complete(["flow", "dotfiles", "repos", "pull", "--"], 4)
|
||||
assert "--repo" in result
|
||||
assert "--dry-run" in result
|
||||
|
||||
|
||||
def test_complete_dotfiles_edit_packages():
|
||||
result = complete(["flow", "dotfiles", "edit", "--"], 3)
|
||||
assert "--no-commit" in result
|
||||
|
||||
|
||||
def test_complete_dotfiles_link_flags():
|
||||
@@ -41,3 +70,17 @@ def test_complete_packages_subcommands():
|
||||
assert "install" in result
|
||||
assert "remove" in result
|
||||
assert "list" in result
|
||||
|
||||
|
||||
def test_complete_dev_attach_returns_empty_on_timeout(monkeypatch):
|
||||
class FakeRuntime:
|
||||
def __init__(self, runner, *, mode="auto"):
|
||||
self.runner = runner
|
||||
|
||||
def ps(self, **kwargs):
|
||||
assert kwargs["timeout"] == 1.0
|
||||
raise subprocess.TimeoutExpired("docker ps", kwargs["timeout"])
|
||||
|
||||
monkeypatch.setattr("flow.commands.completion.ContainerRuntime", FakeRuntime)
|
||||
result = complete(["flow", "dev", "attach", ""], 3)
|
||||
assert result == []
|
||||
|
||||
Reference in New Issue
Block a user