Skip to content

Commit 861525a

Browse files
committed
Use nil as optional organization parameter
1 parent f2280a2 commit 861525a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

client_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func testCreateDevice(t *testing.T) ArduinoDevicev2 {
2727
Type: "mkr1000",
2828
}
2929

30-
device, _, err := client.DevicesV2Api.DevicesV2Create(ctx, devicePayload)
30+
device, _, err := client.DevicesV2Api.DevicesV2Create(ctx, devicePayload, nil)
3131
assert.NoError(t, err, "No errors creating device")
3232
assert.Equal(t, devicePayload.Name, device.Name, "Device name was correctly set")
3333
assert.Equal(t, devicePayload.Type, device.Type, "Device type was correctly set")
@@ -111,7 +111,7 @@ func cleanup() {
111111
}
112112

113113
for _, d := range devices {
114-
_, err = client.DevicesV2Api.DevicesV2Delete(ctx, d.Id)
114+
_, err = client.DevicesV2Api.DevicesV2Delete(ctx, d.Id, nil)
115115
if err != nil {
116116
panic(err)
117117
}
@@ -144,7 +144,7 @@ func TestDevicesAPI(t *testing.T) {
144144
device := testCreateDevice(t)
145145

146146
// Show device
147-
newDevice, _, err := client.DevicesV2Api.DevicesV2Show(ctx, device.Id)
147+
newDevice, _, err := client.DevicesV2Api.DevicesV2Show(ctx, device.Id, nil)
148148
assert.NoError(t, err, "No errors showing device")
149149
assert.Equal(t, device.Name, newDevice.Name, "Device Name is correct")
150150
assert.Equal(t, device.Type, newDevice.Type, "Device ID is correct")
@@ -159,12 +159,12 @@ func TestDevicesAPI(t *testing.T) {
159159
newName := "TestDevice2"
160160
device, _, err = client.DevicesV2Api.DevicesV2Update(ctx, device.Id, Devicev2{
161161
Name: newName,
162-
})
162+
}, nil)
163163
assert.NoError(t, err, "No error updating device")
164164
assert.Equal(t, newName, device.Name, "Name was updated correctly")
165165

166166
// Delete device
167-
_, err = client.DevicesV2Api.DevicesV2Delete(ctx, device.Id)
167+
_, err = client.DevicesV2Api.DevicesV2Delete(ctx, device.Id, nil)
168168
assert.NoError(t, err, "No errors deleting device")
169169

170170
// Ensure device list is empty
@@ -173,7 +173,7 @@ func TestDevicesAPI(t *testing.T) {
173173
assert.Equal(t, 0, len(devices), "Device list is empty")
174174

175175
// Try to get the no more existing device
176-
device, _, err = client.DevicesV2Api.DevicesV2Show(ctx, device.Id)
176+
device, _, err = client.DevicesV2Api.DevicesV2Show(ctx, device.Id, nil)
177177
assert.EqualError(t, err, "401 Unauthorized", "Error should be unauthorized")
178178
assert.Equal(t, ArduinoDevicev2{}, device, "Device should be empty")
179179
}
@@ -205,7 +205,7 @@ func TestThingsAPI(t *testing.T) {
205205
assert.Equal(t, ArduinoThing{}, thing, "Thing should be empty")
206206

207207
// Delete device
208-
_, err = client.DevicesV2Api.DevicesV2Delete(ctx, device.Id)
208+
_, err = client.DevicesV2Api.DevicesV2Delete(ctx, device.Id, nil)
209209
assert.NoError(t, err, "No errors deleting device")
210210
}
211211

@@ -234,7 +234,7 @@ func TestProperties(t *testing.T) {
234234
assert.Equal(t, propertyPayload.UpdateStrategy, property.UpdateStrategy, "Property update strategy was set correctly")
235235

236236
// Generate a sketch
237-
thing, _, err = client.ThingsV2Api.ThingsV2CreateSketch(ctx, thing.Id, ThingSketch{})
237+
thing, _, err = client.ThingsV2Api.ThingsV2CreateSketch(ctx, thing.Id, ThingSketch{}, nil)
238238
assert.NoError(t, err, "No errors creating sketch")
239239
assert.NotNil(t, thing.SketchId, "Sketch ID is not null")
240240

@@ -320,7 +320,7 @@ func TestProperties(t *testing.T) {
320320
assert.NoError(t, err, "No errors getting raw series last value")
321321

322322
// Delete sketch
323-
thing, _, err = client.ThingsV2Api.ThingsV2DeleteSketch(ctx, thing.Id)
323+
thing, _, err = client.ThingsV2Api.ThingsV2DeleteSketch(ctx, thing.Id, nil)
324324
assert.NoError(t, err, "No errors updating sketch")
325325
assert.Equal(t, "", thing.SketchId, "Sketch ID is empty")
326326

@@ -329,7 +329,7 @@ func TestProperties(t *testing.T) {
329329
assert.NoError(t, err, "No errors deleting property")
330330

331331
// Delete device and thing
332-
_, err = client.DevicesV2Api.DevicesV2Delete(ctx, device.Id)
332+
_, err = client.DevicesV2Api.DevicesV2Delete(ctx, device.Id, nil)
333333
assert.NoError(t, err, "No errors deleting device")
334334

335335
_, err = client.ThingsV2Api.ThingsV2Delete(ctx, thing.Id, nil)

0 commit comments

Comments
 (0)