aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/IntegratedTests/TimelineTest.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-08-31 22:39:18 +0800
committercrupest <crupest@outlook.com>2020-08-31 22:39:18 +0800
commit7e414fb4a09e6d35fa32d48fdba38a537ffe1d23 (patch)
tree187696f3303241177820ca65fa441655a03de257 /Timeline.Tests/IntegratedTests/TimelineTest.cs
parent4dda5d088330e76844010a4f89049ea207652318 (diff)
downloadtimeline-7e414fb4a09e6d35fa32d48fdba38a537ffe1d23.tar.gz
timeline-7e414fb4a09e6d35fa32d48fdba38a537ffe1d23.tar.bz2
timeline-7e414fb4a09e6d35fa32d48fdba38a537ffe1d23.zip
Post info now contain data etag.
Diffstat (limited to 'Timeline.Tests/IntegratedTests/TimelineTest.cs')
-rw-r--r--Timeline.Tests/IntegratedTests/TimelineTest.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/Timeline.Tests/IntegratedTests/TimelineTest.cs b/Timeline.Tests/IntegratedTests/TimelineTest.cs
index ac4f41a2..ec46b96a 100644
--- a/Timeline.Tests/IntegratedTests/TimelineTest.cs
+++ b/Timeline.Tests/IntegratedTests/TimelineTest.cs
@@ -1485,5 +1485,39 @@ namespace Timeline.Tests.IntegratedTests
}
}
}
+
+ [Theory]
+ [MemberData(nameof(TimelineUrlGeneratorData))]
+ public async Task PostDataETag(TimelineUrlGenerator urlGenerator)
+ {
+ using var client = await CreateClientAsUser();
+
+ long id;
+ string etag;
+
+ {
+ var res = await client.PostAsJsonAsync(urlGenerator(1, "posts"), new TimelinePostCreateRequest
+ {
+ Content = new TimelinePostCreateRequestContent
+ {
+ Type = TimelinePostContentTypes.Image,
+ Data = Convert.ToBase64String(ImageHelper.CreatePngWithSize(100, 50))
+ }
+ });
+ res.Should().HaveStatusCode(200);
+ var body = await res.ReadBodyAsJsonAsync<TimelinePostInfo>();
+ body.Content.ETag.Should().NotBeNullOrEmpty();
+
+ id = body.Id;
+ etag = body.Content.ETag;
+ }
+
+ {
+ var res = await client.GetAsync(urlGenerator(1, $"posts/{id}/data"));
+ res.Should().HaveStatusCode(200);
+ res.Headers.ETag.Should().NotBeNull();
+ res.Headers.ETag.ToString().Should().Be(etag);
+ }
+ }
}
}