Skip to content

Commit 3aeff22

Browse files
Migrated TestLibCompletion from test_completion.py to completion_test.go
1 parent 7b3a913 commit 3aeff22

File tree

2 files changed

+24
-19
lines changed

2 files changed

+24
-19
lines changed

internal/integrationtest/completion/completion_test.go

+24
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,27 @@ func TestConfigCompletion(t *testing.T) {
156156
stdout, _, _ = cli.Run("__complete", "config", "set", "")
157157
require.Contains(t, string(stdout), "board_manager.additional_urls")
158158
}
159+
160+
// here we test if the completions coming from the libs are working
161+
func TestLibCompletion(t *testing.T) {
162+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
163+
defer env.CleanUp()
164+
165+
_, _, err := cli.Run("lib", "update-index")
166+
require.NoError(t, err)
167+
stdout, _, _ := cli.Run("__complete", "lib", "install", "")
168+
require.Contains(t, string(stdout), "WiFi101")
169+
stdout, _, _ = cli.Run("__complete", "lib", "download", "")
170+
require.Contains(t, string(stdout), "WiFi101")
171+
stdout, _, _ = cli.Run("__complete", "lib", "uninstall", "")
172+
require.NotContains(t, string(stdout), "WiFi101") // not yet installed
173+
174+
_, _, err = cli.Run("lib", "install", "Wifi101")
175+
require.NoError(t, err)
176+
stdout, _, _ = cli.Run("__complete", "lib", "uninstall", "")
177+
require.Contains(t, string(stdout), "WiFi101")
178+
stdout, _, _ = cli.Run("__complete", "lib", "examples", "")
179+
require.Contains(t, string(stdout), "WiFi101")
180+
stdout, _, _ = cli.Run("__complete", "lib", "deps", "")
181+
require.Contains(t, string(stdout), "WiFi101")
182+
}

test/test_completion.py

-19
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,6 @@
1414
# a commercial license, send an email to [email protected].
1515

1616

17-
# here we test if the completions coming from the libs are working
18-
def test_lib_completion(run_command):
19-
assert run_command(["lib", "update-index"])
20-
result = run_command(["__complete", "lib", "install", ""], hide=True)
21-
assert "WiFi101" in result.stdout
22-
result = run_command(["__complete", "lib", "download", ""], hide=True)
23-
assert "WiFi101" in result.stdout
24-
result = run_command(["__complete", "lib", "uninstall", ""], hide=True)
25-
assert "WiFi101" not in result.stdout # not yet installed
26-
27-
assert run_command(["lib", "install", "WiFi101"])
28-
result = run_command(["__complete", "lib", "uninstall", ""])
29-
assert "WiFi101" in result.stdout
30-
result = run_command(["__complete", "lib", "examples", ""])
31-
assert "WiFi101" in result.stdout
32-
result = run_command(["__complete", "lib", "deps", ""])
33-
assert "WiFi101" in result.stdout
34-
35-
3617
# here we test if the completions coming from the core are working
3718
def test_core_completion(run_command):
3819
assert run_command(["core", "update-index"])

0 commit comments

Comments
 (0)