13
13
// Arduino software without disclosing the source code of your own applications.
14
14
// To purchase a commercial license, send an email to [email protected] .
15
15
16
- package board
16
+ package commands
17
17
18
18
import (
19
19
"fmt"
@@ -30,11 +30,9 @@ import (
30
30
semver "go.bug.st/relaxed-semver"
31
31
)
32
32
33
- func init () {
34
- configuration .Settings = configuration .Init ("" )
35
- }
36
-
37
33
func TestGetByVidPid (t * testing.T ) {
34
+ configuration .Settings = configuration .Init ("" )
35
+ configuration .Settings .Set ("locale" , "en" )
38
36
ts := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
39
37
fmt .Fprintln (w , `
40
38
{
@@ -63,6 +61,8 @@ func TestGetByVidPid(t *testing.T) {
63
61
}
64
62
65
63
func TestGetByVidPidNotFound (t * testing.T ) {
64
+ configuration .Settings = configuration .Init ("" )
65
+ configuration .Settings .Set ("locale" , "en" )
66
66
ts := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
67
67
w .WriteHeader (http .StatusNotFound )
68
68
}))
@@ -75,6 +75,8 @@ func TestGetByVidPidNotFound(t *testing.T) {
75
75
}
76
76
77
77
func TestGetByVidPid5xx (t * testing.T ) {
78
+ configuration .Settings = configuration .Init ("" )
79
+ configuration .Settings .Set ("locale" , "en" )
78
80
ts := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
79
81
w .WriteHeader (http .StatusInternalServerError )
80
82
w .Write ([]byte ("500 - Ooooops!" ))
@@ -89,6 +91,8 @@ func TestGetByVidPid5xx(t *testing.T) {
89
91
}
90
92
91
93
func TestGetByVidPidMalformedResponse (t * testing.T ) {
94
+ configuration .Settings = configuration .Init ("" )
95
+ configuration .Settings .Set ("locale" , "en" )
92
96
ts := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
93
97
fmt .Fprintln (w , "{}" )
94
98
}))
@@ -102,12 +106,17 @@ func TestGetByVidPidMalformedResponse(t *testing.T) {
102
106
}
103
107
104
108
func TestBoardDetectionViaAPIWithNonUSBPort (t * testing.T ) {
109
+ configuration .Settings = configuration .Init ("" )
110
+ configuration .Settings .Set ("locale" , "en" )
105
111
items , err := identifyViaCloudAPI (properties .NewMap ())
106
112
require .NoError (t , err )
107
113
require .Empty (t , items )
108
114
}
109
115
110
116
func TestBoardIdentifySorting (t * testing.T ) {
117
+ configuration .Settings = configuration .Init ("" )
118
+ configuration .Settings .Set ("locale" , "en" )
119
+
111
120
dataDir := paths .TempDir ().Join ("test" , "data_dir" )
112
121
t .Setenv ("ARDUINO_DATA_DIR" , dataDir .String ())
113
122
dataDir .MkdirAll ()
0 commit comments