dev.azure.com/aidainnovazione0090/DeviceManager/_git/go-mod-core-contracts@v1.0.2/clients/http/general_test.go (about)

     1  //
     2  // Copyright (C) 2021 IOTech Ltd
     3  // Copyright (C) 2023 Intel Corporation
     4  //
     5  // SPDX-License-Identifier: Apache-2.0
     6  
     7  package http
     8  
     9  import (
    10  	"context"
    11  	"net/http"
    12  	"testing"
    13  
    14  	"github.com/stretchr/testify/require"
    15  
    16  	"dev.azure.com/aidainnovazione0090/DeviceManager/_git/go-mod-core-contracts/common"
    17  	dtoCommon "dev.azure.com/aidainnovazione0090/DeviceManager/_git/go-mod-core-contracts/dtos/common"
    18  )
    19  
    20  func Test_generalClient_FetchConfiguration(t *testing.T) {
    21  	ts := newTestServer(http.MethodGet, common.ApiConfigRoute, dtoCommon.ConfigResponse{})
    22  	defer ts.Close()
    23  
    24  	client := NewGeneralClient(ts.URL, NewNullAuthenticationInjector())
    25  	res, err := client.FetchConfiguration(context.Background())
    26  	require.NoError(t, err)
    27  	require.IsType(t, dtoCommon.ConfigResponse{}, res)
    28  }