diff options
author | crupest <crupest@outlook.com> | 2022-04-11 19:50:03 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-04-11 19:50:03 +0800 |
commit | 671817e186d4f2c6209b8499f381068443a61793 (patch) | |
tree | bc1eb0f88847057e12c36818c664ff133072cf86 /BackEnd | |
parent | f43fb6ea362e52ba5ef07c9ff405b4a17532dab1 (diff) | |
download | timeline-671817e186d4f2c6209b8499f381068443a61793.tar.gz timeline-671817e186d4f2c6209b8499f381068443a61793.tar.bz2 timeline-671817e186d4f2c6209b8499f381068443a61793.zip |
...
Diffstat (limited to 'BackEnd')
-rw-r--r-- | BackEnd/Timeline.Tests/IntegratedTests2/TimelineBookmarkTest.cs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/BackEnd/Timeline.Tests/IntegratedTests2/TimelineBookmarkTest.cs b/BackEnd/Timeline.Tests/IntegratedTests2/TimelineBookmarkTest.cs index f708381f..903175c3 100644 --- a/BackEnd/Timeline.Tests/IntegratedTests2/TimelineBookmarkTest.cs +++ b/BackEnd/Timeline.Tests/IntegratedTests2/TimelineBookmarkTest.cs @@ -106,6 +106,42 @@ namespace Timeline.Tests.IntegratedTests2 TimelineName = "hello" }, expectedStatusCode: HttpStatusCode.UnprocessableEntity); } + + [Fact] + public async Task AnonymousCreateUnauthorized() + { + using var client = CreateDefaultClient(); + + await client.TestJsonSendAsync(HttpMethod.Post, "v2/users/user/bookmarks", new HttpTimelineBookmarkCreateRequest + { + TimelineOwner = "user", + TimelineName = "hello" + }, expectedStatusCode: HttpStatusCode.Unauthorized); + } + + [Fact] + public async Task OtherCreateForbid() + { + using var client = CreateClientAsUser(); + + await client.TestJsonSendAsync(HttpMethod.Post, "v2/users/admin/bookmarks", new HttpTimelineBookmarkCreateRequest + { + TimelineOwner = "user", + TimelineName = "hello" + }, expectedStatusCode: HttpStatusCode.Forbidden); + } + + [Fact] + public async Task AdminCanCreate() + { + using var client = CreateClientAsAdmin(); + + await client.TestJsonSendAsync(HttpMethod.Post, "v2/users/user/bookmarks", new HttpTimelineBookmarkCreateRequest + { + TimelineOwner = "user", + TimelineName = "hello" + }); + } } } |