aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-08-27 01:13:31 +0800
committercrupest <crupest@outlook.com>2020-08-27 01:13:31 +0800
commit7936281edc1ac592cd318b8dccb37f3c4e7334e8 (patch)
tree033a69be9b3db46ad50f8b2703d73de99245f95c /Timeline.Tests
parentd5cc18a9ea161b28e1a7acd67a0c4558ba265800 (diff)
downloadtimeline-7936281edc1ac592cd318b8dccb37f3c4e7334e8.tar.gz
timeline-7936281edc1ac592cd318b8dccb37f3c4e7334e8.tar.bz2
timeline-7936281edc1ac592cd318b8dccb37f3c4e7334e8.zip
Timeline title feature.
Diffstat (limited to 'Timeline.Tests')
-rw-r--r--Timeline.Tests/IntegratedTests/TimelineTest.cs29
-rw-r--r--Timeline.Tests/Services/TimelineServiceTest.cs27
2 files changed, 56 insertions, 0 deletions
diff --git a/Timeline.Tests/IntegratedTests/TimelineTest.cs b/Timeline.Tests/IntegratedTests/TimelineTest.cs
index 3b4b1754..302b2195 100644
--- a/Timeline.Tests/IntegratedTests/TimelineTest.cs
+++ b/Timeline.Tests/IntegratedTests/TimelineTest.cs
@@ -1407,5 +1407,34 @@ namespace Timeline.Tests.IntegratedTests
.Which.Should().BeEquivalentTo(timeline);
}
}
+
+ [Theory]
+ [MemberData(nameof(TimelineUrlGeneratorData))]
+ public async Task Title(TimelineUrlGenerator urlGenerator)
+ {
+ using var client = await CreateClientAsUser();
+
+ {
+ var res = await client.GetAsync(urlGenerator(1));
+ var timeline = res.Should().HaveStatusCode(200)
+ .And.HaveJsonBody<TimelineInfo>()
+ .Which;
+ timeline.Title.Should().Be(timeline.Name);
+ }
+
+ {
+ var res = await client.PatchAsJsonAsync(urlGenerator(1), new TimelinePatchRequest { Title = "atitle" });
+ res.Should().HaveStatusCode(200)
+ .And.HaveJsonBody<TimelineInfo>()
+ .Which.Title.Should().Be("atitle");
+ }
+
+ {
+ var res = await client.GetAsync(urlGenerator(1));
+ res.Should().HaveStatusCode(200)
+ .And.HaveJsonBody<TimelineInfo>()
+ .Which.Title.Should().Be("atitle");
+ }
+ }
}
}
diff --git a/Timeline.Tests/Services/TimelineServiceTest.cs b/Timeline.Tests/Services/TimelineServiceTest.cs
index 36e5ed0c..558ec597 100644
--- a/Timeline.Tests/Services/TimelineServiceTest.cs
+++ b/Timeline.Tests/Services/TimelineServiceTest.cs
@@ -271,5 +271,32 @@ namespace Timeline.Tests.Services
posts.Should().HaveCount(4);
}
}
+
+ [Theory]
+ [InlineData("@admin")]
+ [InlineData("tl")]
+ public async Task Title(string timelineName)
+ {
+ var _ = TimelineHelper.ExtractTimelineName(timelineName, out var isPersonal);
+ if (!isPersonal)
+ await _timelineService.CreateTimeline(timelineName, await _userService.GetUserIdByUsername("user"));
+
+ {
+ var timeline = await _timelineService.GetTimeline(timelineName);
+ timeline.Title.Should().Be(timelineName);
+ }
+
+ {
+ await _timelineService.ChangeProperty(timelineName, new TimelineChangePropertyRequest { Title = null });
+ var timeline = await _timelineService.GetTimeline(timelineName);
+ timeline.Title.Should().Be(timelineName);
+ }
+
+ {
+ await _timelineService.ChangeProperty(timelineName, new TimelineChangePropertyRequest { Title = "atitle" });
+ var timeline = await _timelineService.GetTimeline(timelineName);
+ timeline.Title.Should().Be("atitle");
+ }
+ }
}
}