aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-04-08 17:51:18 +0800
committercrupest <crupest@outlook.com>2022-04-08 17:51:18 +0800
commit1f869ce32839e7f9ded076d6e895b9a4d941f659 (patch)
tree1b532fbcc2680709174ea37835570e475ba94535 /BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs
parentf223683c35bf22bae736621ee77d3ec543a36b01 (diff)
downloadtimeline-1f869ce32839e7f9ded076d6e895b9a4d941f659.tar.gz
timeline-1f869ce32839e7f9ded076d6e895b9a4d941f659.tar.bz2
timeline-1f869ce32839e7f9ded076d6e895b9a4d941f659.zip
...
Diffstat (limited to 'BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs')
-rw-r--r--BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs26
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);
+ }
}
}