Skip to content

Commit

Permalink
test: update Relationships tests to not mention relationship changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tnotheis committed Jun 25, 2024
1 parent 6461d0c commit 804d546
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 57 deletions.
30 changes: 15 additions & 15 deletions ConsumerApi.Tests.Integration/Features/Relationships/POST.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,47 +18,47 @@ Scenario: Creating a Relationship to an Identity in status "ToBeDeleted"
Then the response status code is 400 (Bad Request)
And the response content contains an error with the error code "error.platform.validation.relationship.peerIsToBeDeleted"

Scenario: Accept Relationship Change
Scenario: Accept Relationship
Given Identities i1 and i2
And a pending Relationship between i1 and i2 created by i2
When a POST request is sent to the /Relationships/{r.Id}/Changes/{r.Changes.Id}/Accept endpoint by i1
When a POST request is sent to the /Relationships/{r.Id}/Accept endpoint by i1
Then the response status code is 200 (OK)
And the response contains an AcceptRelationshipChangeResponse
And the response contains an RelationshipResponse

Scenario: Accept Relationship Change to an Identity in status "ToBeDeleted"
Scenario: Accept Relationship to an Identity in status "ToBeDeleted"
Given Identities i1 and i2
And a pending Relationship between i1 and i2 created by i2
And i2 is in status "ToBeDeleted"
When a POST request is sent to the /Relationships/{r.Id}/Changes/{r.Changes.Id}/Accept endpoint by i1
When a POST request is sent to the /Relationships/{r.Id}/Accept endpoint by i1
Then the response status code is 400 (Bad Request)
And the response content contains an error with the error code "error.platform.validation.relationship.peerIsToBeDeleted"

Scenario: Reject Relationship Change
Scenario: Reject Relationship
Given Identities i1 and i2
And a pending Relationship between i1 and i2 created by i2
When a POST request is sent to the /Relationships/{r.Id}/Changes/{r.Changes.Id}/Reject endpoint by i1
When a POST request is sent to the /Relationships/{r.Id}/Reject endpoint by i1
Then the response status code is 200 (OK)
And the response contains an RejectRelationshipChangeResponse
And the response contains an RelationshipResponse

Scenario: Reject Relationship Change to an Identity in status "ToBeDeleted"
Scenario: Reject Relationship to an Identity in status "ToBeDeleted"
Given Identities i1 and i2
And a pending Relationship between i1 and i2 created by i2
And i2 is in status "ToBeDeleted"
When a POST request is sent to the /Relationships/{r.Id}/Changes/{r.Changes.Id}/Reject endpoint by i1
When a POST request is sent to the /Relationships/{r.Id}/Reject endpoint by i1
Then the response status code is 400 (Bad Request)
And the response content contains an error with the error code "error.platform.validation.relationship.peerIsToBeDeleted"

Scenario: Revoke Relationship Change
Scenario: Revoke Relationship
Given Identities i1 and i2
And a pending Relationship between i1 and i2 created by i1
When a POST request is sent to the /Relationships/{r.Id}/Changes/{r.Changes.Id}/Revoke endpoint by i1
When a POST request is sent to the /Relationships/{r.Id}/Revoke endpoint by i1
Then the response status code is 200 (OK)
And the response contains an RevokeRelationshipChangeResponse
And the response contains an RelationshipResponse

Check failure on line 56 in ConsumerApi.Tests.Integration/Features/Relationships/POST.feature

View workflow job for this annotation

GitHub Actions / Run Integration Tests (on Postgres)

RevokeRelationship

System.Text.Json.JsonException : JSON deserialization for type 'Backbone.ConsumerApi.Sdk.Endpoints.Relationships.Types.RelationshipMetadata' was missing required properties, including the following: Id, RelationshipTemplateId, From, To, CreatedAt, Status

Check failure on line 56 in ConsumerApi.Tests.Integration/Features/Relationships/POST.feature

View workflow job for this annotation

GitHub Actions / Run Integration Tests (on SQL Server)

RevokeRelationship

System.Text.Json.JsonException : JSON deserialization for type 'Backbone.ConsumerApi.Sdk.Endpoints.Relationships.Types.RelationshipMetadata' was missing required properties, including the following: Id, RelationshipTemplateId, From, To, CreatedAt, Status

Scenario: Revoke Relationship Change to an Identity in status "ToBeDeleted"
Scenario: Revoke Relationship to an Identity in status "ToBeDeleted"
Given Identities i1 and i2
And a pending Relationship between i1 and i2 created by i1
And i2 is in status "ToBeDeleted"
When a POST request is sent to the /Relationships/{r.Id}/Changes/{r.Changes.Id}/Revoke endpoint by i1
When a POST request is sent to the /Relationships/{r.Id}/Revoke endpoint by i1
Then the response status code is 400 (Bad Request)
And the response content contains an error with the error code "error.platform.validation.relationship.peerIsToBeDeleted"

Check failure on line 64 in ConsumerApi.Tests.Integration/Features/Relationships/POST.feature

View workflow job for this annotation

GitHub Actions / Run Integration Tests (on Postgres)

RevokeRelationshipToAnIdentityInStatusToBeDeleted

System.Text.Json.JsonException : JSON deserialization for type 'Backbone.ConsumerApi.Sdk.Endpoints.Relationships.Types.RelationshipMetadata' was missing required properties, including the following: Id, RelationshipTemplateId, From, To, CreatedAt, Status

Check failure on line 64 in ConsumerApi.Tests.Integration/Features/Relationships/POST.feature

View workflow job for this annotation

GitHub Actions / Run Integration Tests (on SQL Server)

RevokeRelationshipToAnIdentityInStatusToBeDeleted

System.Text.Json.JsonException : JSON deserialization for type 'Backbone.ConsumerApi.Sdk.Endpoints.Relationships.Types.RelationshipMetadata' was missing required properties, including the following: Id, RelationshipTemplateId, From, To, CreatedAt, Status
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ internal class RelationshipsStepDefinitions
private readonly HttpClient _httpClient;
private ApiResponse<CreateRelationshipTemplateResponse>? _relationshipTemplateResponse;
private ApiResponse<RelationshipMetadata>? _createRelationshipResponse;
private ApiResponse<RelationshipMetadata>? _acceptRelationshipChangeResponse;
private ApiResponse<RelationshipMetadata>? _rejectRelationshipChangeResponse;
private ApiResponse<RelationshipMetadata>? _revokeRelationshipChangeResponse;
private ApiResponse<RelationshipMetadata>? _acceptRelationshipResponse;
private ApiResponse<RelationshipMetadata>? _rejectRelationshipResponse;
private ApiResponse<RelationshipMetadata>? _revokeRelationshipResponse;
private string _relationshipId = string.Empty;

public RelationshipsStepDefinitions(HttpClientFactory factory, IOptions<HttpConfiguration> httpConfiguration)
Expand Down Expand Up @@ -92,7 +92,7 @@ public async Task WhenAPostRequestIsSentToTheAcceptRelationshipEndpointByI1()
{
CreationResponseContent = "AAA".GetBytes()
};
_acceptRelationshipChangeResponse = await _client1.Relationships.AcceptRelationship(_relationshipId, acceptRelationshipRequest);
_acceptRelationshipResponse = await _client1.Relationships.AcceptRelationship(_relationshipId, acceptRelationshipRequest);
}

[When("a POST request is sent to the /Relationships/{r.Id}/Reject endpoint by i1")]
Expand All @@ -102,17 +102,17 @@ public async Task WhenAPostRequestIsSentToTheRejectRelationshipChangeEndpointByI
{
CreationResponseContent = "AAA".GetBytes()
};
_rejectRelationshipChangeResponse = await _client1.Relationships.RejectRelationship(_relationshipId, rejectRelationshipRequest);
_rejectRelationshipResponse = await _client1.Relationships.RejectRelationship(_relationshipId, rejectRelationshipRequest);
}

[When("a POST request is sent to the /Relationships/{r.Id}/Changes/{r.Changes.Id}/Revoke endpoint by i1")]
[When("a POST request is sent to the /Relationships/{r.Id}/Revoke endpoint by i1")]
public async Task WhenAPostRequestIsSentToTheRevokeRelationshipChangeEndpointByI2()
{
var revokeRelationshipRequest = new RevokeRelationshipRequest
{
CreationResponseContent = "AAA".GetBytes()
};
_revokeRelationshipChangeResponse = await _client1.Relationships.RevokeRelationship(_relationshipId, revokeRelationshipRequest);
_revokeRelationshipResponse = await _client1.Relationships.RevokeRelationship(_relationshipId, revokeRelationshipRequest);
}

[Then(@"the response status code is (\d\d\d) \(.+\)")]
Expand All @@ -121,14 +121,14 @@ public void ThenTheResponseStatusCodeIs(int expectedStatusCode)
if (_createRelationshipResponse != null)
((int)_createRelationshipResponse!.Status).Should().Be(expectedStatusCode);

if (_acceptRelationshipChangeResponse != null)
((int)_acceptRelationshipChangeResponse!.Status).Should().Be(expectedStatusCode);
if (_acceptRelationshipResponse != null)
((int)_acceptRelationshipResponse!.Status).Should().Be(expectedStatusCode);

if (_rejectRelationshipChangeResponse != null)
((int)_rejectRelationshipChangeResponse!.Status).Should().Be(expectedStatusCode);
if (_rejectRelationshipResponse != null)
((int)_rejectRelationshipResponse!.Status).Should().Be(expectedStatusCode);

if (_revokeRelationshipChangeResponse != null)
((int)_revokeRelationshipChangeResponse!.Status).Should().Be(expectedStatusCode);
if (_revokeRelationshipResponse != null)
((int)_revokeRelationshipResponse!.Status).Should().Be(expectedStatusCode);
}

[Then(@"the response content contains an error with the error code ""([^""]*)""")]
Expand All @@ -140,51 +140,51 @@ public void ThenTheResponseContentIncludesAnErrorWithTheErrorCode(string errorCo
_createRelationshipResponse.Error!.Code.Should().Be(errorCode);
}

if (_acceptRelationshipChangeResponse != null)
if (_acceptRelationshipResponse != null)
{
_acceptRelationshipChangeResponse!.Error.Should().NotBeNull();
_acceptRelationshipChangeResponse.Error!.Code.Should().Be(errorCode);
_acceptRelationshipResponse!.Error.Should().NotBeNull();
_acceptRelationshipResponse.Error!.Code.Should().Be(errorCode);
}

if (_rejectRelationshipChangeResponse != null)
if (_rejectRelationshipResponse != null)
{
_rejectRelationshipChangeResponse!.Error.Should().NotBeNull();
_rejectRelationshipChangeResponse.Error!.Code.Should().Be(errorCode);
_rejectRelationshipResponse!.Error.Should().NotBeNull();
_rejectRelationshipResponse.Error!.Code.Should().Be(errorCode);
}

if (_revokeRelationshipChangeResponse != null)
if (_revokeRelationshipResponse != null)
{
_revokeRelationshipChangeResponse!.Error.Should().NotBeNull();
_revokeRelationshipChangeResponse.Error!.Code.Should().Be(errorCode);
_revokeRelationshipResponse!.Error.Should().NotBeNull();
_revokeRelationshipResponse.Error!.Code.Should().Be(errorCode);
}
}

[Then("the response contains a Relationship")]
public void ThenTheResponseContainsARelationship()
{
_createRelationshipResponse!.Should().BeASuccess();
_createRelationshipResponse!.Should().ComplyWithSchema();
}
if (_createRelationshipResponse != null)
{
_createRelationshipResponse!.Should().BeASuccess();
_createRelationshipResponse!.Should().ComplyWithSchema();
}

[Then("the response contains an AcceptRelationshipChangeResponse")]
public void ThenTheResponseContainsAnAcceptRelationshipChangeResponse()
{
_acceptRelationshipChangeResponse!.Should().BeASuccess();
_acceptRelationshipChangeResponse!.Should().ComplyWithSchema();
}
if (_acceptRelationshipResponse != null)
{
_acceptRelationshipResponse!.Should().BeASuccess();
_acceptRelationshipResponse!.Should().ComplyWithSchema();
}

[Then("the response contains an RejectRelationshipChangeResponse")]
public void ThenTheResponseContainsAnRejectRelationshipChangeResponse()
{
_rejectRelationshipChangeResponse!.Should().BeASuccess();
_rejectRelationshipChangeResponse!.Should().ComplyWithSchema();
}
if (_rejectRelationshipResponse != null)
{
_rejectRelationshipResponse!.Should().BeASuccess();
_rejectRelationshipResponse!.Should().ComplyWithSchema();
}

[Then("the response contains an RevokeRelationshipChangeResponse")]
public void ThenTheResponseContainsAnRevokeRelationshipChangeResponse()
{
_revokeRelationshipChangeResponse!.Should().BeASuccess();
_revokeRelationshipChangeResponse!.Should().ComplyWithSchema();
if (_revokeRelationshipResponse != null)
{
_revokeRelationshipResponse!.Should().BeASuccess();
_revokeRelationshipResponse!.Should().ComplyWithSchema();
}
}

private async Task<ApiResponse<CreateRelationshipTemplateResponse>> CreateRelationshipTemplate(Client client)
Expand Down

0 comments on commit 804d546

Please sign in to comment.