Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b2feb42

Browse files
committedOct 7, 2022
Migrate TestSetBoolWithSingleArgument from test_config.py to config_test.go
1 parent 0d455ab commit b2feb42

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed
 

‎internal/integrationtest/config/config_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,3 +706,26 @@ func TestSetStringWithMultipleArguments(t *testing.T) {
706706
require.Error(t, err)
707707
require.Contains(t, string(stderr), "Can't set multiple values in key logging.level")
708708
}
709+
710+
func TestSetBoolWithSingleArgument(t *testing.T) {
711+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
712+
defer env.CleanUp()
713+
714+
// Create a config file
715+
_, _, err := cli.Run("config", "init", "--dest-dir", ".")
716+
require.NoError(t, err)
717+
718+
// Verifies default state
719+
stdout, _, err := cli.Run("config", "dump", "--format", "json")
720+
require.NoError(t, err)
721+
requirejson.Query(t, stdout, ".library | .enable_unsafe_install", "false")
722+
723+
// Changes value
724+
_, _, err = cli.Run("config", "set", "library.enable_unsafe_install", "true")
725+
require.NoError(t, err)
726+
727+
// Verifies value is changed
728+
stdout, _, err = cli.Run("config", "dump", "--format", "json")
729+
require.NoError(t, err)
730+
requirejson.Query(t, stdout, ".library | .enable_unsafe_install", "true")
731+
}

‎test/test_config.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,6 @@
1717
import yaml
1818

1919

20-
def test_set_bool_with_single_argument(run_command):
21-
# Create a config file
22-
assert run_command(["config", "init", "--dest-dir", "."])
23-
24-
# Verifies default state
25-
result = run_command(["config", "dump", "--format", "json"])
26-
assert result.ok
27-
settings_json = json.loads(result.stdout)
28-
assert not settings_json["library"]["enable_unsafe_install"]
29-
30-
# Changes value
31-
assert run_command(["config", "set", "library.enable_unsafe_install", "true"])
32-
33-
# Verifies value is changed
34-
result = run_command(["config", "dump", "--format", "json"])
35-
assert result.ok
36-
settings_json = json.loads(result.stdout)
37-
assert settings_json["library"]["enable_unsafe_install"]
38-
39-
4020
def test_set_bool_with_multiple_arguments(run_command):
4121
# Create a config file
4222
assert run_command(["config", "init", "--dest-dir", "."])

0 commit comments

Comments
 (0)
Please sign in to comment.