From 1f869ce32839e7f9ded076d6e895b9a4d941f659 Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 8 Apr 2022 17:51:18 +0800 Subject: ... --- .../IntegratedTests2/TimelineTest.cs | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'BackEnd/Timeline.Tests') 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(HttpMethod.Post, "v2/timelines", new HttpTimelineCreateRequest + { + Name = "hello" + }, expectedStatusCode: HttpStatusCode.Created); + + using var adminClient = CreateClientAsAdmin(); + await adminClient.TestJsonSendAsync(HttpMethod.Post, "v2/timelines", new HttpTimelineCreateRequest + { + Name = "hello" + }, expectedStatusCode: HttpStatusCode.Created); + } + + [Fact] + public async Task CreateWithoutLogin() + { + using var client = CreateDefaultClient(); + await client.TestJsonSendAsync(HttpMethod.Post, "v2/timelines", new HttpTimelineCreateRequest + { + Name = "hello" + }, expectedStatusCode: HttpStatusCode.Unauthorized); + } } } -- cgit v1.2.3