From 759a697ce63e62ad40e9cb1e7215d1285721f559 Mon Sep 17 00:00:00 2001 From: Vincent Cloutier Date: Mon, 26 Dec 2022 14:21:58 -0500 Subject: [PATCH] added timeline tests --- README.md | 2 ++ .../TimelineTests.cs | 35 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/Tests/BirdsiteLive.Twitter.Tests/TimelineTests.cs diff --git a/README.md b/README.md index 90447b0..beebd93 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # bird.makeup +[![builds.sr.ht status](https://builds.sr.ht/~cloutier/bird.makeup/commits/master/arch.yml.svg)](https://builds.sr.ht/~cloutier/bird.makeup/commits/master/arch.yml?) + ## About Bird.makeup is a way to follow twitter user from any ActivityPub service. The aim is to make tweets appear as native a possible to the fediverse, while being as scalable as possible. Unlike BirdsiteLive, bird.makeup doesn't use official twitter api, but the undocumented frontend api, just like nitter.net, which doesn't have rate limiting. diff --git a/src/Tests/BirdsiteLive.Twitter.Tests/TimelineTests.cs b/src/Tests/BirdsiteLive.Twitter.Tests/TimelineTests.cs new file mode 100644 index 0000000..c62b1ce --- /dev/null +++ b/src/Tests/BirdsiteLive.Twitter.Tests/TimelineTests.cs @@ -0,0 +1,35 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.Extensions.Logging; +using System.Threading.Tasks; +using BirdsiteLive.Twitter; +using BirdsiteLive.Twitter.Tools; +using BirdsiteLive.Statistics.Domain; +using Moq; + +namespace BirdsiteLive.ActivityPub.Tests +{ + [TestClass] + public class TimelineTests + { + private ITwitterTweetsService _tweetService; + [TestInitialize] + public async Task TestInit() + { + var logger1 = new Mock>(MockBehavior.Strict); + var logger2 = new Mock>(MockBehavior.Strict); + var logger3 = new Mock>(); + var stats = new Mock(); + ITwitterAuthenticationInitializer auth = new TwitterAuthenticationInitializer(logger1.Object); + ITwitterUserService user = new TwitterUserService(auth, stats.Object, logger2.Object); + _tweetService = new TwitterTweetsService(auth, stats.Object, user, logger3.Object); + } + + [TestMethod] + public async Task TimelineKobe() + { + var tweets = await _tweetService.GetTimelineAsync("kobebryant", 100, 100000); + Assert.AreEqual(tweets[0].MessageContent, "Continuing to move the game forward @KingJames. Much respect my brother 💪🏾 #33644"); + } + + } +}