aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/IntegratedTests
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-08-19 16:12:16 +0800
committerGitHub <noreply@github.com>2019-08-19 16:12:16 +0800
commit72ab8e49929d528b7cb461ba90ad86691a3f437b (patch)
treebd8c0d70aac7cd4d1a6c28ae7c9b7c681dbd5613 /Timeline.Tests/IntegratedTests
parent3371b473d0d055f46c9ea09fba7e0d56e7a386a5 (diff)
parent9168f07d1f35b5ba670b3c1d900f186ac868284b (diff)
downloadtimeline-72ab8e49929d528b7cb461ba90ad86691a3f437b.tar.gz
timeline-72ab8e49929d528b7cb461ba90ad86691a3f437b.tar.bz2
timeline-72ab8e49929d528b7cb461ba90ad86691a3f437b.zip
Merge pull request #45 from crupest/avatar-cache
Add 304 response for If-Modified-Since in avatar.
Diffstat (limited to 'Timeline.Tests/IntegratedTests')
-rw-r--r--Timeline.Tests/IntegratedTests/UserAvatarTests.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/Timeline.Tests/IntegratedTests/UserAvatarTests.cs b/Timeline.Tests/IntegratedTests/UserAvatarTests.cs
index efe63346..794f251b 100644
--- a/Timeline.Tests/IntegratedTests/UserAvatarTests.cs
+++ b/Timeline.Tests/IntegratedTests/UserAvatarTests.cs
@@ -6,6 +6,7 @@ using SixLabors.ImageSharp.Formats.Png;
using System;
using System.IO;
using System.Net;
+using System.Net.Http;
using System.Threading.Tasks;
using Timeline.Controllers;
using Timeline.Services;
@@ -64,6 +65,17 @@ namespace Timeline.Tests.IntegratedTests
await GetReturnDefault("admin");
{
+ var request = new HttpRequestMessage()
+ {
+ RequestUri = new Uri(client.BaseAddress, "users/user/avatar"),
+ Method = HttpMethod.Get,
+ };
+ request.Headers.Add("If-Modified-Since", DateTime.Now.ToString("r"));
+ var res = await client.SendAsync(request);
+ res.Should().HaveStatusCode(HttpStatusCode.NotModified);
+ }
+
+ {
var res = await client.PutByteArrayAsync("users/user/avatar", new[] { (byte)0x00 }, "image/notaccept");
res.Should().HaveStatusCode(HttpStatusCode.UnsupportedMediaType);
}