Domains and hosts API (#13963)

* API for domains and hostnames incl. unit tests

* Update Open API json

* Update other unit tests to use new domain service methods where applicable

* Fix merge + update models to new naming scheme

* Handle attempts to add the same domain twice + unit tests for duplicate domain handling

* Review fixes
This commit is contained in:
Kenn Jacobsen
2023-03-15 10:28:23 +01:00
committed by GitHub
parent ea1402de52
commit 4fb011e0fc
19 changed files with 862 additions and 62 deletions

View File

@@ -11,6 +11,7 @@ using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Cache;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.ContentEditing;
using Umbraco.Cms.Core.Models.Membership;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement;
@@ -82,18 +83,28 @@ public class TelemetryProviderTests : UmbracoIntegrationTest
}
[Test]
public void Domain_Telemetry_Provider_Can_Get_Domains()
public async Task Domain_Telemetry_Provider_Can_Get_Domains()
{
// Arrange
DomainService.Save(new UmbracoDomain("danish", "da-DK"));
var contentType = ContentTypeBuilder.CreateBasicContentType();
ContentTypeService.Save(contentType);
var content = ContentBuilder.CreateBasicContent(contentType);
ContentService.Save(content);
await DomainService.UpdateDomainsAsync(
content.Key,
new DomainsUpdateModel
{
Domains = new[] { new DomainModel { DomainName = "english", IsoCode = "en-US" } }
});
IEnumerable<UsageInformation> result = null;
// Act
result = DetailedTelemetryProviders.GetInformation();
IEnumerable<UsageInformation> result = DetailedTelemetryProviders.GetInformation();
// Assert
Assert.AreEqual(1, result.First().Data);
Assert.AreEqual("DomainCount", result.First().Name);
}
[Test]