aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-07-10 20:18:08 +0800
committercrupest <crupest@outlook.com>2020-07-10 20:18:08 +0800
commita362066a9a8e64b8c8d58ec5952cb28caa217b35 (patch)
tree0f28ea177c6e11f419c5edc3f41359a8218f2323 /Timeline.Tests
parent29b3da2aa1f1b4a8514ffea6dc57dda8d8a98170 (diff)
downloadtimeline-a362066a9a8e64b8c8d58ec5952cb28caa217b35.tar.gz
timeline-a362066a9a8e64b8c8d58ec5952cb28caa217b35.tar.bz2
timeline-a362066a9a8e64b8c8d58ec5952cb28caa217b35.zip
Add http api and integrated tests.
Diffstat (limited to 'Timeline.Tests')
-rw-r--r--Timeline.Tests/IntegratedTests/TimelineTest.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/Timeline.Tests/IntegratedTests/TimelineTest.cs b/Timeline.Tests/IntegratedTests/TimelineTest.cs
index 64619864..4ba8800e 100644
--- a/Timeline.Tests/IntegratedTests/TimelineTest.cs
+++ b/Timeline.Tests/IntegratedTests/TimelineTest.cs
@@ -1255,5 +1255,39 @@ namespace Timeline.Tests.IntegratedTests
.And.Subject.Select(p => p.Content.Text).Should().Equal(postContentList.Skip(1));
}
}
+
+ [Theory]
+ [MemberData(nameof(TimelineUrlGeneratorData))]
+ public async Task PostList_IncludeDeleted(TimelineUrlGenerator urlGenerator)
+ {
+ using var client = await CreateClientAsUser();
+
+ var postContentList = new List<string> { "a", "b", "c", "d" };
+ var posts = new List<TimelinePostInfo>();
+
+ foreach (var content in postContentList)
+ {
+ var res = await client.PostAsJsonAsync(urlGenerator(1, "posts"),
+ new TimelinePostCreateRequest { Content = new TimelinePostCreateRequestContent { Text = content, Type = TimelinePostContentTypes.Text } });
+ posts.Add(res.Should().HaveStatusCode(200)
+ .And.HaveJsonBody<TimelinePostInfo>().Which);
+ }
+
+ foreach (var id in new long[] { posts[0].Id, posts[2].Id })
+ {
+ var res = await client.DeleteAsync(urlGenerator(1, $"posts/{id}"));
+ res.Should().BeDelete(true);
+ }
+
+ {
+ var res = await client.GetAsync(urlGenerator(1, "posts", new Dictionary<string, string> { ["includeDeleted"] = "true" }));
+ posts = res.Should().HaveStatusCode(200)
+ .And.HaveJsonBody<List<TimelinePostInfo>>()
+ .Which;
+ posts.Should().HaveCount(4);
+ posts.Select(p => p.Deleted).Should().Equal(true, false, true, false);
+ posts.Select(p => p.Content == null).Should().Equal(true, false, true, false);
+ }
+ }
}
}