Skip to content

[skip-changelog] Migrate tests from test_completion.py to completion_test.go #1844

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

Merged
merged 13 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit Hold shift + click to select a range
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
Next Next commit
Migrated TestLibCompletion from test_completion.py to completion_test.go
  • Loading branch information
MatteoPologruto committed Aug 29, 2022
commit 3aeff22798e4df570ebe20dac2934d19dfed19f7
24 changes: 24 additions & 0 deletions internal/integrationtest/completion/completion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,27 @@ func TestConfigCompletion(t *testing.T) {
stdout, _, _ = cli.Run("__complete", "config", "set", "")
require.Contains(t, string(stdout), "board_manager.additional_urls")
}

// here we test if the completions coming from the libs are working
func TestLibCompletion(t *testing.T) {
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
defer env.CleanUp()

_, _, err := cli.Run("lib", "update-index")
require.NoError(t, err)
stdout, _, _ := cli.Run("__complete", "lib", "install", "")
require.Contains(t, string(stdout), "WiFi101")
stdout, _, _ = cli.Run("__complete", "lib", "download", "")
require.Contains(t, string(stdout), "WiFi101")
stdout, _, _ = cli.Run("__complete", "lib", "uninstall", "")
require.NotContains(t, string(stdout), "WiFi101") // not yet installed

_, _, err = cli.Run("lib", "install", "Wifi101")
require.NoError(t, err)
stdout, _, _ = cli.Run("__complete", "lib", "uninstall", "")
require.Contains(t, string(stdout), "WiFi101")
stdout, _, _ = cli.Run("__complete", "lib", "examples", "")
require.Contains(t, string(stdout), "WiFi101")
stdout, _, _ = cli.Run("__complete", "lib", "deps", "")
require.Contains(t, string(stdout), "WiFi101")
}
19 changes: 0 additions & 19 deletions test/test_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,6 @@
# a commercial license, send an email to license@arduino.cc.


# here we test if the completions coming from the libs are working
def test_lib_completion(run_command):
assert run_command(["lib", "update-index"])
result = run_command(["__complete", "lib", "install", ""], hide=True)
assert "WiFi101" in result.stdout
result = run_command(["__complete", "lib", "download", ""], hide=True)
assert "WiFi101" in result.stdout
result = run_command(["__complete", "lib", "uninstall", ""], hide=True)
assert "WiFi101" not in result.stdout # not yet installed

assert run_command(["lib", "install", "WiFi101"])
result = run_command(["__complete", "lib", "uninstall", ""])
assert "WiFi101" in result.stdout
result = run_command(["__complete", "lib", "examples", ""])
assert "WiFi101" in result.stdout
result = run_command(["__complete", "lib", "deps", ""])
assert "WiFi101" in result.stdout


# here we test if the completions coming from the core are working
def test_core_completion(run_command):
assert run_command(["core", "update-index"])
Expand Down