diff --git a/Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/Features/RelationshipTemplates/{id}/DELETE.feature b/Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/Features/RelationshipTemplates/{id}/DELETE.feature index e4470dd102..c481f6e3b0 100644 --- a/Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/Features/RelationshipTemplates/{id}/DELETE.feature +++ b/Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/Features/RelationshipTemplates/{id}/DELETE.feature @@ -15,5 +15,5 @@ User deletes a Relationship Template Given Identity i And a Relationship Template t created by i When i sends a DELETE request to the /RelationshipTemplates/t.Id endpoint - And i sends a GET request to the /RelationshipTemplates/t.Id endpoint with password "-" + And i sends a GET request to the /RelationshipTemplates/t.Id endpoint Then the response status code is 404 (Not Found) diff --git a/Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/Features/Tokens/{id}/DELETE.feature b/Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/Features/Tokens/{id}/DELETE.feature index 87fe7919cc..810ae8a57f 100644 --- a/Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/Features/Tokens/{id}/DELETE.feature +++ b/Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/Features/Tokens/{id}/DELETE.feature @@ -5,7 +5,7 @@ User deletes a Token Scenario: Deleting a Token actually removes it Given Identity i - And Token t created by i with password "-" and forIdentity - + And Token t created by i When i sends a DELETE request to the /Tokens/t.Id endpoint - And i sends a GET request to the /Tokens/t.Id endpoint with password "-" + And i sends a GET request to the /Tokens/t.Id endpoint Then the response status code is 404 (Not Found) diff --git a/Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/StepDefinitions/RelationshipTemplatesStepDefinitions.cs b/Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/StepDefinitions/RelationshipTemplatesStepDefinitions.cs index d0440cf5e8..7bbbfc76d6 100644 --- a/Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/StepDefinitions/RelationshipTemplatesStepDefinitions.cs +++ b/Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/StepDefinitions/RelationshipTemplatesStepDefinitions.cs @@ -116,6 +116,16 @@ public async Task WhenIdentitySendsAGetRequestToTheRelationshipTemplatesIdEndpoi : await client.RelationshipTemplates.GetTemplate(relationshipTemplateId); } + [When($"{RegexFor.SINGLE_THING} sends a GET request to the /RelationshipTemplates/{RegexFor.SINGLE_THING}.Id endpoint")] + public async Task WhenIdentitySendsAGetRequestToTheRelationshipTemplatesIdEndpoint(string identityName, string relationshipTemplateName) + { + var client = _clientPool.FirstForIdentityName(identityName); + + var relationshipTemplateId = _relationshipTemplatesContext.CreateRelationshipTemplatesResponses[relationshipTemplateName].Id; + + _responseContext.WhenResponse = await client.RelationshipTemplates.GetTemplate(relationshipTemplateId); + } + [When($@"{RegexFor.SINGLE_THING} sends a GET request to the /RelationshipTemplates endpoint with the following payloads")] public async Task WhenISendsAGETRequestToTheRelationshipTemplatesEndpointWithTheFollowingPayloads(string identityName, Table table) { diff --git a/Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/StepDefinitions/TokensStepDefinitions.cs b/Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/StepDefinitions/TokensStepDefinitions.cs index bcbaa759f2..54f5ba92e2 100644 --- a/Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/StepDefinitions/TokensStepDefinitions.cs +++ b/Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/StepDefinitions/TokensStepDefinitions.cs @@ -46,6 +46,17 @@ public async Task GivenRelationshipTemplateCreatedByTokenOwnerWithPasswordAndFor _tokensContext.CreateTokenResponses[relationshipTemplateName] = response.Result!; } + [Given($@"Token {RegexFor.SINGLE_THING} created by {RegexFor.SINGLE_THING}")] + public async Task GivenTokenCreatedByIdentity(string tokenName, string identityName) + { + var client = _clientPool.FirstForIdentityName(identityName); + + var response = await client.Tokens.CreateToken( + new CreateTokenRequest { Content = TestData.SOME_BYTES, ExpiresAt = TOMORROW, ForIdentity = null, Password = null }); + + _tokensContext.CreateTokenResponses[tokenName] = response.Result!; + } + [Given(@"the following Tokens")] public async Task GivenTheFollowingTokens(Table table) { @@ -121,6 +132,20 @@ public async Task WhenIdentitySendsAGetRequestToTheTokensIdEndpointWithPassword( : await client.Tokens.GetTokenUnauthenticated(tokenId); } + [When($@"{RegexFor.OPTIONAL_SINGLE_THING} sends a GET request to the /Tokens/{RegexFor.SINGLE_THING}.Id endpoint")] + public async Task WhenIdentitySendsAGetRequestToTheTokensIdEndpoint(string identityName, string tokenName) + { + var isAuthenticated = identityName != "-"; + + var client = isAuthenticated ? _clientPool.FirstForIdentityName(identityName) : _clientPool.Anonymous; + var tokenId = _tokensContext.CreateTokenResponses[tokenName].Id; + + if (isAuthenticated) + _responseContext.WhenResponse = await client.Tokens.GetToken(tokenId); + else + _responseContext.WhenResponse = await client.Tokens.GetTokenUnauthenticated(tokenId); + } + [When($@"{RegexFor.SINGLE_THING} sends a GET request to the /Tokens endpoint with the following payloads")] public async Task WhenISendsAGETRequestToTheTokensEndpointWithTheFollowingPayloads(string identityName, Table table) {