diff options
author | crupest <crupest@outlook.com> | 2020-02-24 16:58:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-24 16:58:01 +0800 |
commit | cc7dd9ec82ab9f1efd46544e378fd910021f45db (patch) | |
tree | 15a9ecbe1339813d59af04b571f350043df36abc /Timeline.Tests | |
parent | 4475246be00d0f9d1a5df6c181589ed0b2a7009b (diff) | |
parent | bcae79d0b753cccecffac3ae3c7f049b56a8d800 (diff) | |
download | timeline-0.1.0-alpha.tar.gz timeline-0.1.0-alpha.tar.bz2 timeline-0.1.0-alpha.zip |
Merge pull request #61 from crupest/devv0.1.0-alpha
Add delete timeline feature.
Diffstat (limited to 'Timeline.Tests')
-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();
|