aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/IntegratedTests/UserAvatarTest.cs
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-10-24 19:57:59 +0800
committer杨宇千 <crupest@outlook.com>2019-10-24 19:57:59 +0800
commit280faac75b113d9a4bbecd7e4ea3499f1691ce61 (patch)
treeb8ddc07077f9ac767a27f811db4f20ba88cc5087 /Timeline.Tests/IntegratedTests/UserAvatarTest.cs
parentc324d1dad0ffc1a1013b22792078415e7a50c470 (diff)
downloadtimeline-280faac75b113d9a4bbecd7e4ea3499f1691ce61.tar.gz
timeline-280faac75b113d9a4bbecd7e4ea3499f1691ce61.tar.bz2
timeline-280faac75b113d9a4bbecd7e4ea3499f1691ce61.zip
...
Diffstat (limited to 'Timeline.Tests/IntegratedTests/UserAvatarTest.cs')
-rw-r--r--Timeline.Tests/IntegratedTests/UserAvatarTest.cs20
1 files changed, 20 insertions, 0 deletions
diff --git a/Timeline.Tests/IntegratedTests/UserAvatarTest.cs b/Timeline.Tests/IntegratedTests/UserAvatarTest.cs
index ba6d98e1..ce389046 100644
--- a/Timeline.Tests/IntegratedTests/UserAvatarTest.cs
+++ b/Timeline.Tests/IntegratedTests/UserAvatarTest.cs
@@ -40,6 +40,7 @@ namespace Timeline.Tests.IntegratedTests
}
[Fact]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Reliability", "CA2000:Dispose objects before losing scope", Justification = "HttpMessageRequest should be disposed ???")]
public async Task Test()
{
Avatar mockAvatar = new Avatar
@@ -264,6 +265,25 @@ namespace Timeline.Tests.IntegratedTests
.And.Should().HaveCommonBody().Which.Code.Should().Be(Delete.UserNotExist);
}
}
+
+ // bad username check
+ using (var client = await _factory.CreateClientAsAdmin())
+ {
+ {
+ var res = await client.GetAsync("users/u!ser/avatar");
+ res.Should().BeInvalidModel();
+ }
+
+ {
+ var res = await client.PutByteArrayAsync("users/u!ser/avatar", ImageHelper.CreatePngWithSize(100, 100), "image/png");
+ res.Should().BeInvalidModel();
+ }
+
+ {
+ var res = await client.DeleteAsync("users/u!ser/avatar");
+ res.Should().BeInvalidModel();
+ }
+ }
}
}
} \ No newline at end of file