added timeline tests

This commit is contained in:
Vincent Cloutier 2022-12-26 14:21:58 -05:00
parent 999e0c2ba2
commit 759a697ce6
2 changed files with 37 additions and 0 deletions

View file

@ -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.

View file

@ -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<ILogger<TwitterAuthenticationInitializer>>(MockBehavior.Strict);
var logger2 = new Mock<ILogger<TwitterUserService>>(MockBehavior.Strict);
var logger3 = new Mock<ILogger<TwitterTweetsService>>();
var stats = new Mock<ITwitterStatisticsHandler>();
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");
}
}
}