Skip to content

Commit

Permalink
new tests too
Browse files Browse the repository at this point in the history
  • Loading branch information
1riatsila1 committed Oct 21, 2024
1 parent e036e94 commit b26f217
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions pkg/config-api-client/test/api_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,86 @@ func Test_config_api_client_ConfigurationAPIService(t *testing.T) {
})
})

t.Run("Test ConfigurationAPIService GroupsDeleteUxiV1alpha1GroupsGroupUidDelete", func(t *testing.T) {
gock.New(configuration.Scheme + "://" + configuration.Host).
Delete("/uxi/v1alpha1/groups/uid").
Reply(204)

_, httpRes, err := apiClient.ConfigurationAPI.
GroupsDeleteUxiV1alpha1GroupsGroupUidDelete(context.Background(), "uid").
Execute()

require.Nil(t, err)
assert.Equal(t, 204, httpRes.StatusCode)
})

t.Run("Test ConfigurationAPIService GetUxiV1alpha1SensorsGet", func(t *testing.T) {
gock.New(configuration.Scheme + "://" + configuration.Host).
Get("/uxi/v1alpha1/sensors").
MatchParams(map[string]string{"id": "uid", "limit": "10", "cursor": "some-cursor"}).
Reply(200).
JSON(map[string]interface{}{
"items": []map[string]interface{}{
{
"id": "uid",
"serial": "serial",
"name": "name",
"modelNumber": "model_number",
"wifiMacAddress": "wifi_mac_address",
"ethernetMacAddress": "ethernet_mac_address",
"addressNote": "address_note",
"longitude": 0.0,
"latitude": 0.0,
"notes": "notes",
"pcapMode": "pcap_mode",
"type": "uxi/sensor",
},
},
"count": 1,
"next": nil,
})

resp, httpRes, err := apiClient.ConfigurationAPI.
GetUxiV1alpha1SensorsGet(context.Background()).
Id("uid").
Limit(10).
Cursor("some-cursor").
Execute()

resourceType := "uxi/sensor"
ModelNumber := "model_number"
WifiMacAddress := "wifi_mac_address"
EthernetMacAddress := "ethernet_mac_address"
AddressNote := "address_note"
var Longitude float32 = 0.0
var Latitude float32 = 0.0
Notes := "notes"
PcapMode := "pcap_mode"

require.Nil(t, err)
assert.Equal(t, 200, httpRes.StatusCode)
assert.Equal(t, resp, &openapiclient.SensorsResponse{
Items: []openapiclient.SensorItem{
{
Id: "uid",
Serial: "serial",
Name: "name",
ModelNumber: *openapiclient.NewNullableString(&ModelNumber),
WifiMacAddress: *openapiclient.NewNullableString(&WifiMacAddress),
EthernetMacAddress: *openapiclient.NewNullableString(&EthernetMacAddress),
AddressNote: *openapiclient.NewNullableString(&AddressNote),
Longitude: *openapiclient.NewNullableFloat32(&Longitude),
Latitude: *openapiclient.NewNullableFloat32(&Latitude),
Notes: *openapiclient.NewNullableString(&Notes),
PcapMode: *openapiclient.NewNullableString(&PcapMode),
Type: &resourceType,
},
},
Next: *openapiclient.NewNullableString(nil),
Count: 1,
})
})

t.Run("Test ConfigurationAPIService GetUxiV1alpha1SensorGroupAssignmentsGet", func(t *testing.T) {

gock.New(configuration.Scheme + "://" + configuration.Host).
Expand Down

0 comments on commit b26f217

Please sign in to comment.