From 9fe526d9c31dc86acedc88edcc35bfa2ae63c59b Mon Sep 17 00:00:00 2001 From: Elena Shorohova <92329687+jsorohova@users.noreply.github.com> Date: Thu, 8 Feb 2024 15:02:01 +0100 Subject: [PATCH] Fixed management API version mismatch (#2385) * Fixed management API version mismatch * Changed test settings to use the new endpoint * Changed test data jsons --- src/services/tenantService.ts | 4 ++-- tests/mocks/defaultStaticData.json | 26 +++++++++++++++----------- tests/mocks/mockServerData.json | 24 ++++++++++++++---------- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/services/tenantService.ts b/src/services/tenantService.ts index 9c2ac22fd..ea7d56252 100644 --- a/src/services/tenantService.ts +++ b/src/services/tenantService.ts @@ -11,8 +11,8 @@ export class TenantService { * Returns tenant settings. */ public async getSettings(): Promise { - const result = await this.mapiClient.get("/tenant/settings?api-version=2019-12-01", [await this.mapiClient.getPortalHeader("getSettings")]); - return result && result["settings"]; + const result = await this.mapiClient.get("/settings/public", [await this.mapiClient.getPortalHeader("getSettings")]); + return result && result["properties"] && result["properties"]["settings"]; } /** diff --git a/tests/mocks/defaultStaticData.json b/tests/mocks/defaultStaticData.json index facb97bad..a09bfaaf8 100644 --- a/tests/mocks/defaultStaticData.json +++ b/tests/mocks/defaultStaticData.json @@ -1562,7 +1562,7 @@ "count": 1 } }, - "https://contoso.management.azure-api.net/subscriptions/sid/resourceGroups/rgid/providers/Microsoft.ApiManagement/service/sid/tenant/settings": { + "https://contoso.management.azure-api.net/subscriptions/sid/resourceGroups/rgid/providers/Microsoft.ApiManagement/service/sid/settings/public": { "headers": [ { "name": "content-type", @@ -1572,16 +1572,20 @@ "statusCode": 200, "statusText": "OK", "body": { - "id": "/settings/public", - "settings": { - "CustomPortalSettings.UserRegistrationTerms": "", - "CustomPortalSettings.UserRegistrationTermsEnabled": "False", - "CustomPortalSettings.UserRegistrationTermsConsentRequired": "False", - "CustomPortalSettings.DelegationEnabled": "False", - "CustomPortalSettings.DelegationUrl": "", - "CustomPortalSettings.DelegatedSubscriptionEnabled": "False", - "CustomPortalSettings.RequireUserSigninEnabled": "True" - } + "id": "/subscriptions/sid/resourceGroups/rgid/providers/Microsoft.ApiManagement/service/sid/settings/public", + "type": "Microsoft.ApiManagement/service/settings", + "name": "public", + "properties": { + "settings": { + "CustomPortalSettings.UserRegistrationTerms": "", + "CustomPortalSettings.UserRegistrationTermsEnabled": "False", + "CustomPortalSettings.UserRegistrationTermsConsentRequired": "False", + "CustomPortalSettings.DelegationEnabled": "False", + "CustomPortalSettings.DelegationUrl": "", + "CustomPortalSettings.DelegatedSubscriptionEnabled": "False", + "CustomPortalSettings.RequireUserSigninEnabled": "True" + } + } } }, "https://contoso.management.azure-api.net/subscriptions/sid/resourceGroups/rgid/providers/Microsoft.ApiManagement/service/sid/products/unlimited": { diff --git a/tests/mocks/mockServerData.json b/tests/mocks/mockServerData.json index 03ba11b76..9da193253 100644 --- a/tests/mocks/mockServerData.json +++ b/tests/mocks/mockServerData.json @@ -93,18 +93,22 @@ "count": 0 } }, - "/subscriptions/sid/resourceGroups/rgid/providers/Microsoft.ApiManagement/service/sid/tenant/settings":{ + "/subscriptions/sid/resourceGroups/rgid/providers/Microsoft.ApiManagement/service/sid/settings/public":{ "statusCode": 200, "body": { - - "id": "/settings/public", - "settings": { - "CustomPortalSettings.UserRegistrationTerms": null, - "CustomPortalSettings.UserRegistrationTermsEnabled": "False", - "CustomPortalSettings.UserRegistrationTermsConsentRequired": "False", - "CustomPortalSettings.DelegationEnabled": "False", - "CustomPortalSettings.DelegationUrl": "", - "CustomPortalSettings.DelegatedSubscriptionEnabled": "False" + "id": "/subscriptions/sid/resourceGroups/rgid/providers/Microsoft.ApiManagement/service/sid/settings/public", + "type": "Microsoft.ApiManagement/service/settings", + "name": "public", + "properties": { + "settings": { + "CustomPortalSettings.UserRegistrationTerms": "", + "CustomPortalSettings.UserRegistrationTermsEnabled": "False", + "CustomPortalSettings.UserRegistrationTermsConsentRequired": "False", + "CustomPortalSettings.DelegationEnabled": "False", + "CustomPortalSettings.DelegationUrl": "", + "CustomPortalSettings.DelegatedSubscriptionEnabled": "False", + "CustomPortalSettings.RequireUserSigninEnabled": "True" + } } } },