diff options
author | 杨宇千 <crupest@outlook.com> | 2019-10-24 19:57:59 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-10-24 19:57:59 +0800 |
commit | 912455ac19161533205c2fe56b91ff4595ea4fdb (patch) | |
tree | b8ddc07077f9ac767a27f811db4f20ba88cc5087 /Timeline.Tests/IntegratedTests/UserAvatarTest.cs | |
parent | 89c106169bd2a16310fdaa6e0c48a3402d97de3a (diff) | |
download | timeline-912455ac19161533205c2fe56b91ff4595ea4fdb.tar.gz timeline-912455ac19161533205c2fe56b91ff4595ea4fdb.tar.bz2 timeline-912455ac19161533205c2fe56b91ff4595ea4fdb.zip |
...
Diffstat (limited to 'Timeline.Tests/IntegratedTests/UserAvatarTest.cs')
-rw-r--r-- | Timeline.Tests/IntegratedTests/UserAvatarTest.cs | 20 |
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 |