-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added integration test for the install endpoints (#15483)
- Loading branch information
Showing
3 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
tests/Umbraco.Tests.Integration/ManagementApi/Install/SettingsInstallControllerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System.Linq.Expressions; | ||
using System.Net; | ||
using Umbraco.Cms.Api.Management.Controllers.Install; | ||
|
||
namespace Umbraco.Cms.Tests.Integration.ManagementApi.Install; | ||
|
||
public class SettingsInstallControllerTests : ManagementApiUserGroupTestBase<SettingsInstallController> | ||
{ | ||
protected override Expression<Func<SettingsInstallController, object>> MethodSelector => | ||
x => x.Settings(); | ||
|
||
protected override UserGroupAssertionModel AdminUserGroupAssertionModel => new() | ||
{ | ||
ExpectedStatusCode = HttpStatusCode.PreconditionRequired | ||
}; | ||
|
||
protected override UserGroupAssertionModel EditorUserGroupAssertionModel => new() | ||
{ | ||
ExpectedStatusCode = HttpStatusCode.PreconditionRequired | ||
}; | ||
|
||
protected override UserGroupAssertionModel SensitiveDataUserGroupAssertionModel => new() | ||
{ | ||
ExpectedStatusCode = HttpStatusCode.PreconditionRequired | ||
}; | ||
|
||
protected override UserGroupAssertionModel TranslatorUserGroupAssertionModel => new() | ||
{ | ||
ExpectedStatusCode = HttpStatusCode.PreconditionRequired | ||
}; | ||
|
||
protected override UserGroupAssertionModel WriterUserGroupAssertionModel => new() | ||
{ | ||
ExpectedStatusCode = HttpStatusCode.PreconditionRequired | ||
}; | ||
|
||
protected override UserGroupAssertionModel UnauthorizedUserGroupAssertionModel => new() | ||
{ | ||
ExpectedStatusCode = HttpStatusCode.PreconditionRequired | ||
}; | ||
} |
58 changes: 58 additions & 0 deletions
58
tests/Umbraco.Tests.Integration/ManagementApi/Install/SetupInstallControllerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using System.Linq.Expressions; | ||
using System.Net; | ||
using System.Net.Http.Json; | ||
using Umbraco.Cms.Api.Management.Controllers.Install; | ||
using Umbraco.Cms.Api.Management.ViewModels.Installer; | ||
using Umbraco.Cms.Core.Models; | ||
|
||
namespace Umbraco.Cms.Tests.Integration.ManagementApi.Install; | ||
|
||
public class SetupInstallControllerTests : ManagementApiUserGroupTestBase<SetupInstallController> | ||
{ | ||
protected override Expression<Func<SetupInstallController, object>> MethodSelector => | ||
x => x.Setup(null); | ||
|
||
protected override UserGroupAssertionModel AdminUserGroupAssertionModel => new() | ||
{ | ||
ExpectedStatusCode = HttpStatusCode.PreconditionRequired | ||
}; | ||
|
||
protected override UserGroupAssertionModel EditorUserGroupAssertionModel => new() | ||
{ | ||
ExpectedStatusCode = HttpStatusCode.PreconditionRequired | ||
}; | ||
|
||
protected override UserGroupAssertionModel SensitiveDataUserGroupAssertionModel => new() | ||
{ | ||
ExpectedStatusCode = HttpStatusCode.PreconditionRequired | ||
}; | ||
|
||
protected override UserGroupAssertionModel TranslatorUserGroupAssertionModel => new() | ||
{ | ||
ExpectedStatusCode = HttpStatusCode.PreconditionRequired | ||
}; | ||
|
||
protected override UserGroupAssertionModel WriterUserGroupAssertionModel => new() | ||
{ | ||
ExpectedStatusCode = HttpStatusCode.PreconditionRequired | ||
}; | ||
|
||
protected override UserGroupAssertionModel UnauthorizedUserGroupAssertionModel => new() | ||
{ | ||
ExpectedStatusCode = HttpStatusCode.PreconditionRequired | ||
}; | ||
|
||
protected override async Task<HttpResponseMessage> ClientRequest() | ||
{ | ||
InstallVResponseModel installResponseModel = new() | ||
{ | ||
User = new UserInstallResponseModel | ||
{ | ||
Name = "Tester", Email = "[email protected]", Password = "123457890" | ||
}, | ||
Database = new DatabaseInstallResponseModel { Id = Guid.NewGuid(), ProviderName = "TestProviderName" }, | ||
TelemetryLevel = TelemetryLevel.Basic | ||
}; | ||
return await Client.PostAsync(Url, JsonContent.Create(installResponseModel)); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...Umbraco.Tests.Integration/ManagementApi/Install/ValidateDatabaseInstallControllerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System.Linq.Expressions; | ||
using System.Net; | ||
using System.Net.Http.Json; | ||
using Umbraco.Cms.Api.Management.Controllers.Install; | ||
using Umbraco.Cms.Api.Management.ViewModels.Installer; | ||
|
||
namespace Umbraco.Cms.Tests.Integration.ManagementApi.Install; | ||
|
||
public class ValidateDatabaseInstallControllerTests : ManagementApiUserGroupTestBase<ValidateDatabaseInstallController> | ||
{ | ||
protected override Expression<Func<ValidateDatabaseInstallController, object>> MethodSelector => | ||
x => x.ValidateDatabase(null); | ||
|
||
protected override UserGroupAssertionModel AdminUserGroupAssertionModel => new() | ||
{ | ||
ExpectedStatusCode = HttpStatusCode.PreconditionRequired | ||
}; | ||
|
||
protected override UserGroupAssertionModel EditorUserGroupAssertionModel => new() | ||
{ | ||
ExpectedStatusCode = HttpStatusCode.PreconditionRequired | ||
}; | ||
|
||
protected override UserGroupAssertionModel SensitiveDataUserGroupAssertionModel => new() | ||
{ | ||
ExpectedStatusCode = HttpStatusCode.PreconditionRequired | ||
}; | ||
|
||
protected override UserGroupAssertionModel TranslatorUserGroupAssertionModel => new() | ||
{ | ||
ExpectedStatusCode = HttpStatusCode.PreconditionRequired | ||
}; | ||
|
||
protected override UserGroupAssertionModel WriterUserGroupAssertionModel => new() | ||
{ | ||
ExpectedStatusCode = HttpStatusCode.PreconditionRequired | ||
}; | ||
|
||
protected override UserGroupAssertionModel UnauthorizedUserGroupAssertionModel => new() | ||
{ | ||
ExpectedStatusCode = HttpStatusCode.PreconditionRequired | ||
}; | ||
|
||
protected override async Task<HttpResponseMessage> ClientRequest() | ||
{ | ||
DatabaseInstallResponseModel databaseInstallResponseModel = new() | ||
{ | ||
Id = Guid.NewGuid(), ProviderName = "TestProviderName", | ||
}; | ||
return await Client.PostAsync(Url, JsonContent.Create(databaseInstallResponseModel)); | ||
} | ||
} |