From 5367f55228d1d5769d5a52e2ed7e8d84eb8764e0 Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Fri, 29 Sep 2023 17:08:37 +0200 Subject: [PATCH] fix test --- .../fetchers/azure/assets_fetcher_test.go | 40 +++++++++---------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/resources/fetching/fetchers/azure/assets_fetcher_test.go b/resources/fetching/fetchers/azure/assets_fetcher_test.go index 5805caaaef..03cec43dd1 100644 --- a/resources/fetching/fetchers/azure/assets_fetcher_test.go +++ b/resources/fetching/fetchers/azure/assets_fetcher_test.go @@ -53,29 +53,25 @@ func (s *AzureAssetsFetcherTestSuite) TestFetcher_Fetch() { ctx := context.Background() mockInventoryService := &inventory.MockServiceAPI{} - mockAssets := []inventory.AzureAsset{ - { - Id: "id1", - Name: "name1", - Location: "location1", - Properties: map[string]interface{}{"key1": "value1"}, - ResourceGroup: "rg1", - SubscriptionId: "subId1", - TenantId: "tenantId1", - Type: inventory.VirtualMachineAssetType, - }, - { - Id: "id2", - Name: "name2", - Location: "location2", - Properties: map[string]interface{}{"key2": "value2"}, - ResourceGroup: "rg2", - SubscriptionId: "subId2", - TenantId: "tenantId2", - Type: inventory.StorageAccountAssetType, - }, + var mockAssets []inventory.AzureAsset + for _, assetType := range []string{ + inventory.DiskAssetType, + inventory.StorageAccountAssetType, + inventory.VirtualMachineAssetType, + } { + mockAssets = append(mockAssets, + inventory.AzureAsset{ + Id: "id", + Name: "name", + Location: "location", + Properties: map[string]interface{}{"key": "value"}, + ResourceGroup: "rg", + SubscriptionId: "subId", + TenantId: "tenantId", + Type: assetType, + }, + ) } - mockInventoryService.EXPECT(). ListAllAssetTypesByName(mock.AnythingOfType("[]string")). Return(mockAssets, nil).Once()