diff options
author | crupest <crupest@outlook.com> | 2020-02-24 16:52:19 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-02-24 16:52:19 +0800 |
commit | 8be166185139b691ec53537115c5902caf3c5eb4 (patch) | |
tree | 15a9ecbe1339813d59af04b571f350043df36abc /Timeline.Tests/IntegratedTests/TimelineTest.cs | |
parent | 5e04f3db229546e5a6de95fd36f6c41e5304b2cf (diff) | |
download | timeline-8be166185139b691ec53537115c5902caf3c5eb4.tar.gz timeline-8be166185139b691ec53537115c5902caf3c5eb4.tar.bz2 timeline-8be166185139b691ec53537115c5902caf3c5eb4.zip |
Add delete timeline.
Diffstat (limited to 'Timeline.Tests/IntegratedTests/TimelineTest.cs')
-rw-r--r-- | Timeline.Tests/IntegratedTests/TimelineTest.cs | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/Timeline.Tests/IntegratedTests/TimelineTest.cs b/Timeline.Tests/IntegratedTests/TimelineTest.cs index 51653b0a..14a0a59e 100644 --- a/Timeline.Tests/IntegratedTests/TimelineTest.cs +++ b/Timeline.Tests/IntegratedTests/TimelineTest.cs @@ -316,6 +316,62 @@ namespace Timeline.Tests.IntegratedTests }
[Fact]
+ public async Task TimelineDelete_Should_Work()
+ {
+ await CreateTestTimelines();
+
+ {
+ using var client = await CreateDefaultClient();
+ var res = await client.DeleteAsync("timelines/t1");
+ res.Should().HaveStatusCode(HttpStatusCode.Unauthorized);
+ }
+
+ {
+ using var client = await CreateClientAs(2);
+ var res = await client.DeleteAsync("timelines/t1");
+ res.Should().HaveStatusCode(HttpStatusCode.Forbidden);
+ }
+
+ {
+ using var client = await CreateClientAsAdministrator();
+
+ {
+ var res = await client.DeleteAsync("timelines/!!!");
+ res.Should().BeInvalidModel();
+ }
+
+ {
+ var res = await client.DeleteAsync("timelines/t2");
+ res.Should().BeDelete(true);
+ }
+
+ {
+ var res = await client.DeleteAsync("timelines/t2");
+ res.Should().BeDelete(false);
+ }
+ }
+
+ {
+ using var client = await CreateClientAs(1);
+
+ {
+ var res = await client.DeleteAsync("timelines/!!!");
+ res.Should().BeInvalidModel();
+ }
+
+ {
+ var res = await client.DeleteAsync("timelines/t1");
+ res.Should().BeDelete(true);
+ }
+
+ {
+ var res = await client.DeleteAsync("timelines/t1");
+ res.Should().HaveStatusCode(HttpStatusCode.NotFound);
+ }
+ }
+ }
+
+ [Fact]
public async Task InvalidModel_BadName()
{
using var client = await CreateClientAsAdministrator();
|