Skip to content

Commit a347d4e

Browse files
Migrate TestSearchParagraph from test_lib.py to lib_test.go
1 parent 307d507 commit a347d4e

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

internal/integrationtest/lib/lib_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,3 +764,22 @@ func TestSearch(t *testing.T) {
764764
runSearch("arduinojson", []string{"ArduinoJson"})
765765
runSearch("json", []string{"ArduinoJson", "Arduino_JSON"})
766766
}
767+
768+
func TestSearchParagraph(t *testing.T) {
769+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
770+
defer env.CleanUp()
771+
772+
// Search for a string that's only present in the `paragraph` field
773+
// within the index file.
774+
_, _, err := cli.Run("lib", "update-index")
775+
require.NoError(t, err)
776+
stdout, _, err := cli.Run("lib", "search", "A simple and efficient JSON library", "--names", "--format", "json")
777+
require.NoError(t, err)
778+
requirejson.Contains(t, stdout, `{
779+
"libraries": [
780+
{
781+
"name": "ArduinoJson"
782+
}
783+
]
784+
}`)
785+
}

test/test_lib.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -146,19 +146,6 @@ def test_install_with_zip_path(run_command, data_dir, downloads_dir):
146146
assert lib_install_dir / "README.adoc" in files
147147

148148

149-
def test_search_paragraph(run_command):
150-
"""
151-
Search for a string that's only present in the `paragraph` field
152-
within the index file.
153-
"""
154-
assert run_command(["lib", "update-index"])
155-
result = run_command(["lib", "search", "A simple and efficient JSON library", "--names", "--format", "json"])
156-
assert result.ok
157-
data = json.loads(result.stdout)
158-
libraries = [l["name"] for l in data["libraries"]]
159-
assert "ArduinoJson" in libraries
160-
161-
162149
def test_lib_list_with_updatable_flag(run_command):
163150
# Init the environment explicitly
164151
run_command(["lib", "update-index"])

0 commit comments

Comments
 (0)