Skip to content

Commit c722ce6

Browse files
authored
Merge branch 'main' into introduce-lockfiles
2 parents d5bfdcc + 8fce9d5 commit c722ce6

File tree

45 files changed

+163
-2556
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+163
-2556
lines changed

Applications/AdminApi/test/AdminApi.Tests.Integration/Features/Clients/PUT.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Scenario: Changing the default tier of an existing Client with a non-existent ti
2323
Then the response status code is 400 (Bad request)
2424
And the response content contains an error with the error code "error.platform.validation.device.tierIdInvalidOrDoesNotExist"
2525

26-
Scenario: Changing the default tier of a non-existing Client
26+
Scenario: Updating a non-existing Client
2727
When a PUT request is sent to the /Clients/{c.clientId} endpoint with a non-existing clientId
2828
Then the response status code is 404 (Not Found)
2929
And the response content contains an error with the error code "error.platform.recordNotFound"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@Integration
2+
Feature: GET Identities/{identityAddress}
3+
4+
User requests an Identity
5+
6+
Scenario: Requesting an Identity by address
7+
Given an Identity i
8+
When a GET request is sent to the /Identities/{i.address} endpoint
9+
Then the response status code is 200 (OK)
10+
And the response contains Identity i
11+
12+
Scenario: Requesting an Identity with non existent address
13+
When a GET request is sent to the /Identities/{address} endpoint with an inexistent address
14+
Then the response status code is 404 (Not Found)
15+
And the response content contains an error with the error code "error.platform.recordNotFound"

Applications/AdminApi/test/AdminApi.Tests.Integration/Features/IndividualQuotas/DELETE.feature

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ Scenario: Deleting an inexistent Individual Quota
1313
When a DELETE request is sent to the /Identities/{i.address}/Quotas/inexistentQuotaId endpoint
1414
Then the response status code is 404 (Not Found)
1515
And the response content contains an error with the error code "error.platform.recordNotFound"
16+
17+
Scenario: Deleting an Individual Quota for a non existent Identity
18+
Given an Identity i with an IndividualQuota q
19+
When a DELETE request is sent to the /Identities/{nonExistentAddress}/Quotas/{q.id} endpoint
20+
Then the response status code is 404 (Not Found)
21+
And the response content contains an error with the error code "error.platform.recordNotFound"

Applications/AdminApi/test/AdminApi.Tests.Integration/Features/IndividualQuotas/POST.feature

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ Scenario: Creating an Individual Quota for inexistent Identity
1313
When a POST request is sent to the /Identity/{address}/Quotas endpoint with an inexistent identity address
1414
Then the response status code is 404 (Not Found)
1515
And the response content contains an error with the error code "error.platform.recordNotFound"
16+
17+
Scenario: Creating an Individual Quota for a non existent Metric Key
18+
Given an Identity i
19+
When a POST request is sent to the /Identity/{i.id}/Quotas endpoint with an invalid metric key
20+
Then the response status code is 400 (Bad Request)
21+
And the response content contains an error with the error code "error.platform.quotas.unsupportedMetricKey"

Applications/AdminApi/test/AdminApi.Tests.Integration/Features/TierQuotas/DELETE.feature

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ Scenario: Deleting an inexistent Tier Quota
1313
When a DELETE request is sent to the /Tiers/{t.id}/Quotas/{quotaId} endpoint with an inexistent quota id
1414
Then the response status code is 404 (Not Found)
1515
And the response content contains an error with the error code "error.platform.recordNotFound"
16+
17+
Scenario: Deleting a Tier Quota for a non existent Tier
18+
Given a Tier t with a Quota q
19+
When a DELETE request is sent to the /Tiers/{nonExistentTier}/Quotas/{q.id}
20+
Then the response status code is 404 (Not Found)
21+
And the response content contains an error with the error code "error.platform.recordNotFound"

Applications/AdminApi/test/AdminApi.Tests.Integration/Features/TierQuotas/POST.feature

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ Scenario: Creating a Tier Quota for inexistent Tier
1313
When a POST request is sent to the /Tiers/{tierId}/Quotas endpoint with an inexistent tier id
1414
Then the response status code is 404 (Not Found)
1515
And the response content contains an error with the error code "error.platform.recordNotFound"
16+
17+
Scenario: Creating a Tier Quota for a non existent Metric Key
18+
Given a Tier t
19+
When a POST request is sent to the /Tiers/{t.id}/Quotas endpoint with an invalid metric key
20+
Then the response status code is 400 (Bad Request)
21+
And the response content contains an error with the error code "error.platform.quotas.unsupportedMetricKey"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@Integration
2+
Feature: GET Tiers/{id}
3+
4+
User requests a Tier
5+
6+
Scenario: Requesting a Tier by id
7+
Given a Tier t
8+
When a GET request is sent to the /Tiers/{t.id} endpoint
9+
Then the response status code is 200 (OK)
10+
And the response contains Tier t
11+
12+
Scenario: Requesting a Tier with non existent address
13+
When a GET request is sent to the /Tiers/{nonExistentTierId} endpoint
14+
Then the response status code is 404 (Not Found)
15+
And the response content contains an error with the error code "error.platform.recordNotFound"

Applications/AdminApi/test/AdminApi.Tests.Integration/StepDefinitions/IdentitiesApiStepDefinitions.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
using Backbone.AdminApi.Tests.Integration.Configuration;
44
using Backbone.AdminApi.Tests.Integration.Extensions;
55
using Backbone.BuildingBlocks.SDK.Endpoints.Common.Types;
6+
using Backbone.UnitTestTools.Data;
67
using Microsoft.Extensions.Options;
78

89
namespace Backbone.AdminApi.Tests.Integration.StepDefinitions;
910

1011
[Binding]
1112
[Scope(Feature = "GET Identities")]
1213
[Scope(Feature = "POST Identities/{id}/DeletionProcess")]
14+
[Scope(Feature = "GET Identities/{identityAddress}")]
1315
[Scope(Feature = "GET Identities/{identityAddress}/DeletionProcesses/AuditLogs")]
1416
internal class IdentitiesApiStepDefinitions : BaseStepDefinitions
1517
{
@@ -67,7 +69,7 @@ public async Task WhenAGETRequestIsSentToTheIdentitiesAddressEndpoint()
6769
[When("a GET request is sent to the /Identities/{address} endpoint with an inexistent address")]
6870
public async Task WhenAGETRequestIsSentToTheIdentitiesAddressEndpointForAnInexistentIdentity()
6971
{
70-
_identityResponse = await _client.Identities.GetIdentity("inexistentIdentityAddress");
72+
_identityResponse = await _client.Identities.GetIdentity(TestDataGenerator.CreateRandomIdentityAddress());
7173
}
7274

7375
[Then("the response contains a list of Identities")]
@@ -123,7 +125,7 @@ public void ThenTheResponseContentIncludesAnErrorWithTheErrorCode(string errorCo
123125
{
124126
if (_identityResponse != null)
125127
{
126-
_identityResponse!.Result!.Should().NotBeNull();
128+
_identityResponse!.Error!.Should().NotBeNull();
127129
_identityResponse.Error!.Code.Should().Be(errorCode);
128130
}
129131

Applications/AdminApi/test/AdminApi.Tests.Integration/StepDefinitions/IndividualQuotaStepDefinitions.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ public async Task WhenADeleteRequestIsSentToTheDeleteIndividualQuotaEndpointWith
5858
_deleteResponse = await _client.Identities.DeleteIndividualQuota(_identityAddress, "QUOInexistentIdxxxxx");
5959
}
6060

61+
[When("a DELETE request is sent to the /Identities/{nonExistentAddress}/Quotas/{q.id} endpoint")]
62+
public async Task WhenADeleteRequestIsSentToTheDeleteIndividualQuotaEndpointWithANonExistentIdentityAddress()
63+
{
64+
_deleteResponse = await _client.Identities.DeleteIndividualQuota("someNonExistentIdentityAddress", _quotaId);
65+
}
66+
6167
[When("a POST request is sent to the /Identity/{i.id}/Quotas endpoint")]
6268
public async Task WhenAPOSTRequestIsSentToTheCreateIndividualQuotaEndpoint()
6369
{
@@ -80,6 +86,17 @@ public async Task WhenAPOSTRequestIsSentToTheCreateIndividualQuotaEndpointWithAn
8086
});
8187
}
8288

89+
[When("a POST request is sent to the /Identity/{i.id}/Quotas endpoint with an invalid metric key")]
90+
public async Task WhenAPOSTRequestIsSentToTheCreateIndividualQuotaEndpointWithAnInvalidMetricKey()
91+
{
92+
_createQuotaResponse = await _client.Identities.CreateIndividualQuota(_identityAddress, new CreateQuotaForIdentityRequest
93+
{
94+
MetricKey = "someInvalidMetricKey",
95+
Max = 2,
96+
Period = "Week"
97+
});
98+
}
99+
83100
[Then(@"the response status code is (\d+) \(.+\)")]
84101
public void ThenTheResponseStatusCodeIs(int expectedStatusCode)
85102
{

Applications/AdminApi/test/AdminApi.Tests.Integration/StepDefinitions/TierQuotaStepDefinitions.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,17 @@ public async Task WhenAPOSTRequestIsSentToTheCreateTierQuotaEndpoint()
6666
});
6767
}
6868

69+
[When("a POST request is sent to the /Tiers/{t.id}/Quotas endpoint with an invalid metric key")]
70+
public async Task WhenAPOSTRequestIsSentToTheCreateTierQuotaEndpointWithAnInvalidMetricKey()
71+
{
72+
_createTierQuotaResponse = await _client.Tiers.AddTierQuota(_tierId, new CreateQuotaForTierRequest
73+
{
74+
MetricKey = "SomeInvalidMetricKey",
75+
Max = 2,
76+
Period = "Week"
77+
});
78+
}
79+
6980
[When("a POST request is sent to the /Tiers/{tierId}/Quotas endpoint with an inexistent tier id")]
7081
public async Task WhenAPOSTRequestIsSentToTheCreateTierQuotaEndpointForAnInexistentTier()
7182
{
@@ -89,6 +100,12 @@ public async Task WhenADeleteRequestIsSentToTheDeleteTierQuotaEndpointForAnInexi
89100
_deleteResponse = await _client.Tiers.DeleteTierQuota(_tierId, "inexistentQuotaId");
90101
}
91102

103+
[When("a DELETE request is sent to the /Tiers/{nonExistentTier}/Quotas/{q.id}")]
104+
public async Task WhenADeleteRequestIsSentToTheDeleteTierQuotaEndpointWithANonExistentTierId()
105+
{
106+
_deleteResponse = await _client.Tiers.DeleteTierQuota("nonExistentTierId", _tierQuotaDefinitionId);
107+
}
108+
92109
[Then(@"the response status code is (\d+) \(.+\)")]
93110
public void ThenTheResponseStatusCodeIs(int expectedStatusCode)
94111
{

Applications/AdminApi/test/AdminApi.Tests.Integration/StepDefinitions/TiersStepDefinitions.cs

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ namespace Backbone.AdminApi.Tests.Integration.StepDefinitions;
1111

1212
[Binding]
1313
[Scope(Feature = "GET Tiers")]
14+
[Scope(Feature = "GET Tiers/{id}")]
1415
[Scope(Feature = "POST Tier")]
1516
[Scope(Feature = "DELETE Tier")]
1617
internal class TiersStepDefinitions : BaseStepDefinitions
1718
{
1819
private ApiResponse<Tier>? _tierResponse;
20+
private ApiResponse<TierDetails>? _getTierResponse;
1921
private ApiResponse<EmptyResponse>? _deleteResponse;
2022
private ApiResponse<ListTiersResponse>? _tiersResponse;
2123
private string _existingTierName;
@@ -54,6 +56,18 @@ public async Task WhenAGETRequestIsSentToTheTiersEndpoint()
5456
_tiersResponse = await _client.Tiers.ListTiers();
5557
}
5658

59+
[When("a GET request is sent to the /Tiers/{t.id} endpoint")]
60+
public async Task WhenAGETRequestIsSentToTheTiersByIdEndpoint()
61+
{
62+
_getTierResponse = await _client.Tiers.GetTier(_existingTierId);
63+
}
64+
65+
[When("a GET request is sent to the /Tiers/{nonExistentTierId} endpoint")]
66+
public async Task WhenAGETRequestIsSentToTheTiersByIdEndpointWithANonExistentId()
67+
{
68+
_getTierResponse = await _client.Tiers.GetTier("TIRNonExistentId1231");
69+
}
70+
5771
[When("a POST request is sent to the /Tiers endpoint")]
5872
public async Task WhenAPOSTRequestIsSentToTheTiersEndpoint()
5973
{
@@ -94,6 +108,15 @@ public async Task ThenTheResponseContainsATier()
94108
await _tierResponse.Should().ComplyWithSchema();
95109
}
96110

111+
[Then("the response contains Tier t")]
112+
public async Task ThenTheResponseContainsTierT()
113+
{
114+
_getTierResponse!.Should().BeASuccess();
115+
_getTierResponse!.ContentType.Should().StartWith("application/json");
116+
await _getTierResponse.Should().ComplyWithSchema();
117+
_getTierResponse.Result!.Id.Should().Be(_existingTierId);
118+
}
119+
97120
[Then(@"the response status code is (\d+) \(.+\)")]
98121
public void ThenTheResponseStatusCodeIs(int expectedStatusCode)
99122
{
@@ -105,12 +128,24 @@ public void ThenTheResponseStatusCodeIs(int expectedStatusCode)
105128

106129
if (_deleteResponse != null)
107130
((int)_deleteResponse!.Status).Should().Be(expectedStatusCode);
131+
132+
if (_getTierResponse != null)
133+
((int)_getTierResponse!.Status).Should().Be(expectedStatusCode);
108134
}
109135

110136
[Then(@"the response content contains an error with the error code ""([^""]+)""")]
111137
public void ThenTheResponseContentIncludesAnErrorWithTheErrorCode(string errorCode)
112138
{
113-
_tierResponse!.Error.Should().NotBeNull();
114-
_tierResponse.Error!.Code.Should().Be(errorCode);
139+
if (_tierResponse != null)
140+
{
141+
_tierResponse!.Error.Should().NotBeNull();
142+
_tierResponse.Error!.Code.Should().Be(errorCode);
143+
}
144+
145+
if (_getTierResponse != null)
146+
{
147+
_getTierResponse!.Error.Should().NotBeNull();
148+
_getTierResponse.Error!.Code.Should().Be(errorCode);
149+
}
115150
}
116151
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@Integration
2+
Feature: PUT Identities/Self/DeletionProcesses/{id}/Approve
3+
4+
User approves a deletion process
5+
6+
Scenario: Approve a non-existent deletion process
7+
Given an Identity i
8+
When a PUT request is sent to the /Identities/Self/DeletionProcesses/{id}/Approve endpoint with a non-existent deletionProcessId
9+
Then the response status code is 404 (Not Found)
10+
And the response content contains an error with the error code "error.platform.recordNotFound"

Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/Features/Relationships/POST.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@Integration
1+
@Integration
22
Feature: POST Relationship
33

44
User creates a Relationship

Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/StepDefinitions/IdentitiesApiStepDefinitions.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ namespace Backbone.ConsumerApi.Tests.Integration.StepDefinitions;
1818

1919
[Binding]
2020
[Scope(Feature = "POST Identities/Self/DeletionProcess")]
21+
[Scope(Feature = "PUT Identities/Self/DeletionProcesses/{id}/Approve")]
2122
[Scope(Feature = "POST Identity")]
2223
internal class IdentitiesApiStepDefinitions
2324
{
2425
private Client _sdk = null!;
2526
private readonly ClientCredentials _clientCredentials;
2627
private readonly HttpClient _httpClient;
2728
private ApiResponse<StartDeletionProcessResponse>? _startDeletionProcessResponse;
29+
private ApiResponse<ApproveDeletionProcessResponse>? _approveDeletionProcessResponse;
2830
private ApiResponse<CreateIdentityResponse>? _identityResponse;
2931
private ApiResponse<Challenge>? _challengeResponse;
3032

@@ -64,6 +66,12 @@ public async Task WhenAPOSTRequestIsSentToTheIdentitiesSelfDeletionProcessEndpoi
6466
_startDeletionProcessResponse = await _sdk.Identities.StartDeletionProcess();
6567
}
6668

69+
[When("a PUT request is sent to the /Identities/Self/DeletionProcesses/{id}/Approve endpoint with a non-existent deletionProcessId")]
70+
public async Task WhenAPutRequestIsSentToTheIdentitiesSelfDeletionProcessesIdApproveEndpointWithANonExistentDeletionProcessId()
71+
{
72+
_approveDeletionProcessResponse = await _sdk.Identities.ApproveDeletionProcess("IDPSomeNonExistentId");
73+
}
74+
6775
[When("a POST request is sent to the /Identities endpoint with a valid signature on c")]
6876
public async Task WhenAPOSTRequestIsSentToTheIdentitiesEndpoint()
6977
{
@@ -94,8 +102,17 @@ public async Task WhenAPOSTRequestIsSentToTheIdentitiesEndpoint()
94102
[Then(@"the response content contains an error with the error code ""([^""]*)""")]
95103
public void ThenTheResponseContentIncludesAnErrorWithTheErrorCode(string errorCode)
96104
{
97-
_startDeletionProcessResponse!.Error.Should().NotBeNull();
98-
_startDeletionProcessResponse.Error!.Code.Should().Be(errorCode);
105+
if (_startDeletionProcessResponse != null)
106+
{
107+
_startDeletionProcessResponse!.Error.Should().NotBeNull();
108+
_startDeletionProcessResponse.Error!.Code.Should().Be(errorCode);
109+
}
110+
111+
if (_approveDeletionProcessResponse != null)
112+
{
113+
_approveDeletionProcessResponse!.Error.Should().NotBeNull();
114+
_approveDeletionProcessResponse.Error!.Code.Should().Be(errorCode);
115+
}
99116
}
100117

101118
[Then("the response contains a Deletion Process")]

Modules/Challenges/test/Challenges.Application.Tests/Tests/Identities/Commands/DeleteIdentityCommandTests/HandlerTests.cs

Lines changed: 0 additions & 32 deletions
This file was deleted.

Modules/Devices/test/Devices.Application.Tests/Tests/Clients/Commands/ChangeClientSecret/HandlerTests.cs

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)