File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -157,3 +157,30 @@ func TestWrite(t *testing.T) {
157157 // We don't verify the content since we expect config library, Viper, to work
158158 require .True (t , configFile .Exist ())
159159}
160+
161+ func TestDelete (t * testing.T ) {
162+ temp , err := paths .TempDir ().MkTempDir ("testdata" )
163+ require .NoError (t , err )
164+ defer temp .RemoveAll ()
165+
166+ configFile := temp .Join ("arduino-cli.yml" )
167+
168+ _ , err = svc .Delete (context .Background (), & rpc.DeleteRequest {
169+ Key : "doesnotexist" ,
170+ FilePath : configFile .String (),
171+ })
172+ require .Error (t , err )
173+
174+ _ , err = svc .Delete (context .Background (), & rpc.DeleteRequest {
175+ Key : "network" ,
176+ FilePath : configFile .String (),
177+ })
178+ require .NoError (t , err )
179+
180+ data , err := configFile .ReadFile ()
181+ require .NoError (t , err )
182+ require .NotContains (t , string (data ), "network" )
183+
184+ _ , err = svc .GetValue (context .Background (), & rpc.GetValueRequest {Key : "network" })
185+ require .Error (t , err )
186+ }
Original file line number Diff line number Diff line change @@ -14,3 +14,6 @@ logging:
1414 file : " "
1515 format : text
1616 level : info
17+
18+ network :
19+ proxy : " 123"
You can’t perform that action at this time.
0 commit comments