Browse Source
Update test suite (#871)
* Fix resizer url.
* Fix app routing.
* Fix logic?
* Fix schema resolver.
* Cleanup.
* Unused classes removed.
* Fix
* Update test suite.
* Fix URL handling.
pull/872/head
Sebastian Stehle
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with
54 additions and
12 deletions
-
backend/tools/TestSuite/TestSuite.ApiTests/AnonymousTests.cs
-
backend/tools/TestSuite/TestSuite.ApiTests/AssetFixture.cs
-
backend/tools/TestSuite/TestSuite.ApiTests/ContentLanguageTests.cs
-
backend/tools/TestSuite/TestSuite.ApiTests/ContentQueryFixture.cs
-
backend/tools/TestSuite/TestSuite.ApiTests/OpenApiTests.cs
-
backend/tools/TestSuite/TestSuite.LoadTests/ReadingFixture.cs
-
backend/tools/TestSuite/TestSuite.Shared/TestSuite.Shared.csproj
|
|
|
@ -45,7 +45,7 @@ namespace TestSuite.ApiTests |
|
|
|
|
|
|
|
|
|
|
|
// STEP 3: Check anonymous permission
|
|
|
|
var url = $"{_.ClientManager.Options.Url}/api/apps/{appName}/settings"; |
|
|
|
var url = $"{_.ClientManager.Options.Url}api/apps/{appName}/settings"; |
|
|
|
|
|
|
|
using (var httpClient = new HttpClient()) |
|
|
|
{ |
|
|
|
@ -82,7 +82,7 @@ namespace TestSuite.ApiTests |
|
|
|
|
|
|
|
|
|
|
|
// STEP 3: Create a content.
|
|
|
|
var url = $"{_.ClientManager.Options.Url}/api/content/{appName}/my-content"; |
|
|
|
var url = $"{_.ClientManager.Options.Url}api/content/{appName}/my-content"; |
|
|
|
|
|
|
|
using (var httpClient = new HttpClient()) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -18,7 +18,9 @@ namespace TestSuite.ApiTests |
|
|
|
|
|
|
|
using (var client = new HttpClient()) |
|
|
|
{ |
|
|
|
var url = $"{ServerUrl}{asset._links["content"].Href}"; |
|
|
|
client.BaseAddress = new Uri(ServerUrl); |
|
|
|
|
|
|
|
var url = asset._links["content"].Href; |
|
|
|
|
|
|
|
if (version > 0) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -112,7 +112,7 @@ namespace TestSuite.ApiTests |
|
|
|
|
|
|
|
private async Task<(string, string)> GetEtagAsync(string id, Dictionary<string, string> headers) |
|
|
|
{ |
|
|
|
var url = $"{_.ClientManager.Options.Url}/api/content/{_.AppName}/{_.SchemaName}/{id}"; |
|
|
|
var url = $"{_.ClientManager.Options.Url}api/content/{_.AppName}/{_.SchemaName}/{id}"; |
|
|
|
|
|
|
|
using (var httpClient = _.ClientManager.CreateHttpClient()) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -5,6 +5,8 @@ |
|
|
|
// All rights reserved. Licensed under the MIT license.
|
|
|
|
// ==========================================================================
|
|
|
|
|
|
|
|
using System.Globalization; |
|
|
|
using Newtonsoft.Json.Linq; |
|
|
|
using Squidex.ClientLibrary; |
|
|
|
using TestSuite.Fixtures; |
|
|
|
using TestSuite.Model; |
|
|
|
@ -24,9 +26,25 @@ namespace TestSuite.ApiTests |
|
|
|
|
|
|
|
await DisposeAsync(); |
|
|
|
|
|
|
|
for (var i = 10; i > 0; i--) |
|
|
|
for (var index = 10; index > 0; index--) |
|
|
|
{ |
|
|
|
var data = TestEntity.CreateTestEntry(i); |
|
|
|
var data = new TestEntityData |
|
|
|
{ |
|
|
|
Number = index, |
|
|
|
Json = JObject.FromObject(new |
|
|
|
{ |
|
|
|
nested1 = new |
|
|
|
{ |
|
|
|
nested2 = index |
|
|
|
} |
|
|
|
}), |
|
|
|
Geo = GeoJson.Point(index, index, oldFormat: index % 2 == 1), |
|
|
|
Localized = new Dictionary<string, string> |
|
|
|
{ |
|
|
|
["en"] = index.ToString(CultureInfo.InvariantCulture) |
|
|
|
}, |
|
|
|
String = index.ToString(CultureInfo.InvariantCulture), |
|
|
|
}; |
|
|
|
|
|
|
|
await Contents.CreateAsync(data, ContentCreateOptions.AsPublish); |
|
|
|
} |
|
|
|
|
|
|
|
@ -24,7 +24,7 @@ namespace TestSuite.ApiTests |
|
|
|
[Fact] |
|
|
|
public async Task Should_provide_general_spec() |
|
|
|
{ |
|
|
|
var url = $"{_.ClientManager.Options.Url}/api/swagger/v1/swagger.json"; |
|
|
|
var url = $"{_.ClientManager.Options.Url}api/swagger/v1/swagger.json"; |
|
|
|
|
|
|
|
var document = await OpenApiDocument.FromUrlAsync(url); |
|
|
|
|
|
|
|
@ -34,7 +34,7 @@ namespace TestSuite.ApiTests |
|
|
|
[Fact] |
|
|
|
public async Task Should_provide_content_spec() |
|
|
|
{ |
|
|
|
var url = $"{_.ClientManager.Options.Url}/api/content/{_.AppName}/swagger/v1/swagger.json"; |
|
|
|
var url = $"{_.ClientManager.Options.Url}api/content/{_.AppName}/swagger/v1/swagger.json"; |
|
|
|
|
|
|
|
var document = await OpenApiDocument.FromUrlAsync(url); |
|
|
|
|
|
|
|
@ -44,7 +44,7 @@ namespace TestSuite.ApiTests |
|
|
|
[Fact] |
|
|
|
public async Task Should_provide_flat_content_spec() |
|
|
|
{ |
|
|
|
var url = $"{_.ClientManager.Options.Url}/api/content/{_.AppName}/flat/swagger/v1/swagger.json"; |
|
|
|
var url = $"{_.ClientManager.Options.Url}api/content/{_.AppName}/flat/swagger/v1/swagger.json"; |
|
|
|
|
|
|
|
var document = await OpenApiDocument.FromUrlAsync(url); |
|
|
|
|
|
|
|
|
|
|
|
@ -5,6 +5,8 @@ |
|
|
|
// All rights reserved. Licensed under the MIT license.
|
|
|
|
// ==========================================================================
|
|
|
|
|
|
|
|
using System.Globalization; |
|
|
|
using Newtonsoft.Json.Linq; |
|
|
|
using Squidex.ClientLibrary; |
|
|
|
using TestSuite.Fixtures; |
|
|
|
using TestSuite.Model; |
|
|
|
@ -24,9 +26,29 @@ namespace TestSuite.LoadTests |
|
|
|
|
|
|
|
await DisposeAsync(); |
|
|
|
|
|
|
|
for (var i = 10; i > 0; i--) |
|
|
|
var current = await Contents.GetAsync(new ContentQuery |
|
|
|
{ |
|
|
|
var data = TestEntity.CreateTestEntry(i); |
|
|
|
Top = 0 |
|
|
|
}); |
|
|
|
|
|
|
|
var countTotal = (int)current.Total; |
|
|
|
var countMissing = 100 - countTotal; |
|
|
|
|
|
|
|
for (var index = countMissing; index > 0; index--) |
|
|
|
{ |
|
|
|
var data = new TestEntityData |
|
|
|
{ |
|
|
|
Number = index, |
|
|
|
Json = JObject.FromObject(new |
|
|
|
{ |
|
|
|
nested0 = index, |
|
|
|
nested1 = new |
|
|
|
{ |
|
|
|
nested2 = index |
|
|
|
} |
|
|
|
}), |
|
|
|
String = index.ToString(CultureInfo.InvariantCulture) |
|
|
|
}; |
|
|
|
|
|
|
|
await Contents.CreateAsync(data, ContentCreateOptions.AsPublish); |
|
|
|
} |
|
|
|
|
|
|
|
@ -16,7 +16,7 @@ |
|
|
|
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.1" /> |
|
|
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" /> |
|
|
|
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" /> |
|
|
|
<PackageReference Include="Squidex.ClientLibrary" Version="8.12.0" /> |
|
|
|
<PackageReference Include="Squidex.ClientLibrary" Version="8.16.0" /> |
|
|
|
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" /> |
|
|
|
<PackageReference Include="xunit" Version="2.4.1" /> |
|
|
|
</ItemGroup> |
|
|
|
|