Skip to content

Commit 4642fd8

Browse files
chore: Address comments
1 parent 4f5f0fa commit 4642fd8

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/Contexts/TagsContext.cs

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

Applications/ConsumerApi/test/ConsumerApi.Tests.Integration/Features/Tags/GET.feature

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ User requests available Tags
1010
And the response attributes contain tags
1111

1212
Scenario: Requesting the tags with the current hash
13-
Given the most current hash h
14-
When A GET request to the /Tags endpoint gets sent with hash h
13+
Given a list of tags l with an ETag e
14+
And I didn't change since the last fetch
15+
When A GET request to the /Tags endpoint gets sent with the If-None-Match header set to e
1516
Then the response status code is 304 (Not modified)
17+
And the response content is empty

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,28 @@ public class TagsStepDefinitions
1111
{
1212
private readonly ResponseContext _responseContext;
1313
private readonly ClientPool _clientPool;
14-
private readonly TagsContext _tagsContext;
1514

1615
private CachedApiResponse<ListTagsResponse>? _listTagsResponse;
1716

1817
public TagsStepDefinitions(ResponseContext responseContext, ClientPool clientPool)
1918
{
2019
_responseContext = responseContext;
2120
_clientPool = clientPool;
22-
_tagsContext = new TagsContext();
2321
}
2422

2523
#region Given
2624

27-
[Given($@"the most current hash {RegexFor.SINGLE_THING}")]
28-
public async Task GivenTheMostCurrentHash(string hash)
25+
[Given($@"a list of tags {RegexFor.SINGLE_THING} with an ETag {RegexFor.SINGLE_THING}")]
26+
public async Task GivenAListOfTagsWithETag(string list, string hash)
2927
{
3028
await WhenAGETRequestToTheTagsEndpointGetsSent();
3129

3230
_listTagsResponse!.Should().BeASuccess();
31+
}
3332

34-
_tagsContext.TagHashes[hash] = _listTagsResponse!.ETag;
33+
[Given("I didn't change since the last fetch")]
34+
public void GivenIDidntChangeSinceLastFetch()
35+
{
3536
}
3637

3738
#endregion
@@ -46,11 +47,11 @@ public async Task WhenAGETRequestToTheTagsEndpointGetsSent()
4647
_responseContext.WhenResponse = _listTagsResponse = await client.Tags.ListTags();
4748
}
4849

49-
[When($@"A GET request to the /Tags endpoint gets sent with hash {RegexFor.SINGLE_THING}")]
50+
[When($@"A GET request to the /Tags endpoint gets sent with the If-None-Match header set to {RegexFor.SINGLE_THING}")]
5051
public async Task WhenAGETRequestToTheTagsEndpointGetsSentWithHash(string hash)
5152
{
5253
var client = _clientPool.Anonymous;
53-
_responseContext.WhenResponse = _listTagsResponse = await client.Tags.ListTags(new CacheControl { ETag = _tagsContext.TagHashes[hash] });
54+
_responseContext.WhenResponse = _listTagsResponse = await client.Tags.ListTags(new CacheControl { ETag = _listTagsResponse!.ETag });
5455
}
5556

5657
#endregion
@@ -72,5 +73,12 @@ public void AndTheResponseAttributesContainTags()
7273
}
7374
}
7475

76+
[Then("the response content is empty")]
77+
public void ThenTheResponseContentIsEmpty()
78+
{
79+
_listTagsResponse!.NotModified.Should().BeTrue();
80+
_listTagsResponse!.Result.Should().BeNull();
81+
}
82+
7583
#endregion
7684
}

Sdks/ConsumerApi.Sdk/src/Endpoints/Tags/TagsEndpoint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ public class TagsEndpoint(EndpointClient client) : ConsumerApiEndpoint(client)
88
{
99
public async Task<CachedApiResponse<ListTagsResponse>> ListTags(CacheControl? cacheControl = null)
1010
{
11-
return await _client.GetCachedUnauthenticated<ListTagsResponse>($"api/{API_VERSION}/Tags", null, null, cacheControl);
11+
return await _client.GetCachedUnauthenticated<ListTagsResponse>($"api/{API_VERSION}/Tags", cacheControl: cacheControl);
1212
}
1313
}

0 commit comments

Comments
 (0)