diff options
author | crupest <crupest@outlook.com> | 2022-04-08 17:51:18 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-04-08 17:51:18 +0800 |
commit | 1f869ce32839e7f9ded076d6e895b9a4d941f659 (patch) | |
tree | 1b532fbcc2680709174ea37835570e475ba94535 /BackEnd/Timeline.Tests | |
parent | f223683c35bf22bae736621ee77d3ec543a36b01 (diff) | |
download | timeline-1f869ce32839e7f9ded076d6e895b9a4d941f659.tar.gz timeline-1f869ce32839e7f9ded076d6e895b9a4d941f659.tar.bz2 timeline-1f869ce32839e7f9ded076d6e895b9a4d941f659.zip |
...
Diffstat (limited to 'BackEnd/Timeline.Tests')
-rw-r--r-- | BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs b/BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs index 73ab35f2..484ee096 100644 --- a/BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs +++ b/BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs @@ -54,6 +54,32 @@ namespace Timeline.Tests.IntegratedTests2 Name = "!!!" }, expectedStatusCode: HttpStatusCode.UnprocessableEntity); } + + [Fact] + public async Task DifferentUserCreateSameName() + { + using var userClient = CreateClientAsUser(); + await userClient.TestJsonSendAsync<HttpTimeline>(HttpMethod.Post, "v2/timelines", new HttpTimelineCreateRequest + { + Name = "hello" + }, expectedStatusCode: HttpStatusCode.Created); + + using var adminClient = CreateClientAsAdmin(); + await adminClient.TestJsonSendAsync<HttpTimeline>(HttpMethod.Post, "v2/timelines", new HttpTimelineCreateRequest + { + Name = "hello" + }, expectedStatusCode: HttpStatusCode.Created); + } + + [Fact] + public async Task CreateWithoutLogin() + { + using var client = CreateDefaultClient(); + await client.TestJsonSendAsync<HttpTimeline>(HttpMethod.Post, "v2/timelines", new HttpTimelineCreateRequest + { + Name = "hello" + }, expectedStatusCode: HttpStatusCode.Unauthorized); + } } } |