updated saving tweets + tests

This commit is contained in:
Nicolas Constant 2023-01-06 02:08:57 -05:00
parent bc55778089
commit f1a49d1dd1
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
3 changed files with 22 additions and 12 deletions

View File

@ -18,13 +18,13 @@ namespace BirdsiteLive.Pipeline.Processors.SubTasks
protected async Task SaveSyncTweetAsync(string acct, long tweetId, string host, string inbox)
{
var inboxUrl = $"https://{host}/{inbox.Trim('/')}";
var tweet = new SyncTweet
{
Acct = acct,
TweetId = tweetId,
PublishedAt = DateTime.UtcNow,
Inbox = inboxUrl
Inbox = inbox,
Host = host
};
await _syncTweetsPostgresDal.SaveTweetAsync(tweet);
}

View File

@ -94,7 +94,8 @@ namespace BirdsiteLive.Pipeline.Tests.Processors.SubTasks
.Setup(x => x.SaveTweetAsync(
It.Is<SyncTweet>(y => y.Acct == twitterHandle
&& y.TweetId == tweetId
&& y.Inbox == $"https://{host}{inbox}"
&& y.Inbox == inbox
&& y.Host == host
&& y.PublishedAt != default)))
.ReturnsAsync(-1);
#endregion
@ -257,7 +258,8 @@ namespace BirdsiteLive.Pipeline.Tests.Processors.SubTasks
.Setup(x => x.SaveTweetAsync(
It.Is<SyncTweet>(y => y.Acct == twitterHandle
&& y.TweetId == tweetId
&& y.Inbox == $"https://{host}{inbox}"
&& y.Inbox == inbox
&& y.Host == host
&& y.PublishedAt != default)))
.ReturnsAsync(-1);
#endregion
@ -349,7 +351,8 @@ namespace BirdsiteLive.Pipeline.Tests.Processors.SubTasks
.Setup(x => x.SaveTweetAsync(
It.Is<SyncTweet>(y => y.Acct == twitterHandle
&& y.TweetId == tweetId
&& y.Inbox == $"https://{host}{inbox}"
&& y.Inbox == inbox
&& y.Host == host
&& y.PublishedAt != default)))
.ReturnsAsync(-1);
#endregion
@ -444,7 +447,8 @@ namespace BirdsiteLive.Pipeline.Tests.Processors.SubTasks
.Setup(x => x.SaveTweetAsync(
It.Is<SyncTweet>(y => y.Acct == twitterHandle
&& y.TweetId == tweetId
&& y.Inbox == $"https://{host}{inbox}"
&& y.Inbox == inbox
&& y.Host == host
&& y.PublishedAt != default)))
.ReturnsAsync(-1);
}
@ -546,7 +550,8 @@ namespace BirdsiteLive.Pipeline.Tests.Processors.SubTasks
.Setup(x => x.SaveTweetAsync(
It.Is<SyncTweet>(y => y.Acct == twitterHandle
&& y.TweetId == tweetId2
&& y.Inbox == $"https://{host}{inbox}"
&& y.Inbox == inbox
&& y.Host == host
&& y.PublishedAt != default)))
.ReturnsAsync(-1);

View File

@ -115,7 +115,8 @@ namespace BirdsiteLive.Pipeline.Tests.Processors.SubTasks
.Setup(x => x.SaveTweetAsync(
It.Is<SyncTweet>(y => y.Acct == twitterHandle
&& y.TweetId == tweetId
&& y.Inbox == $"https://{host}{inbox}"
&& y.Inbox == inbox
&& y.Host == host
&& y.PublishedAt != default)))
.ReturnsAsync(-1);
#endregion
@ -321,7 +322,8 @@ namespace BirdsiteLive.Pipeline.Tests.Processors.SubTasks
.Setup(x => x.SaveTweetAsync(
It.Is<SyncTweet>(y => y.Acct == twitterHandle
&& y.TweetId == tweetId
&& y.Inbox == $"https://{host}{inbox}"
&& y.Inbox == inbox
&& y.Host == host
&& y.PublishedAt != default)))
.ReturnsAsync(-1);
#endregion
@ -434,7 +436,8 @@ namespace BirdsiteLive.Pipeline.Tests.Processors.SubTasks
.Setup(x => x.SaveTweetAsync(
It.Is<SyncTweet>(y => y.Acct == twitterHandle
&& y.TweetId == tweetId
&& y.Inbox == $"https://{host}{inbox}"
&& y.Inbox == inbox
&& y.Host == host
&& y.PublishedAt != default)))
.ReturnsAsync(-1);
#endregion
@ -550,7 +553,8 @@ namespace BirdsiteLive.Pipeline.Tests.Processors.SubTasks
.Setup(x => x.SaveTweetAsync(
It.Is<SyncTweet>(y => y.Acct == twitterHandle
&& y.TweetId == tweetId
&& y.Inbox == $"https://{host}{inbox}"
&& y.Inbox == inbox
&& y.Host == host
&& y.PublishedAt != default)))
.ReturnsAsync(-1);
}
@ -673,7 +677,8 @@ namespace BirdsiteLive.Pipeline.Tests.Processors.SubTasks
.Setup(x => x.SaveTweetAsync(
It.Is<SyncTweet>(y => y.Acct == twitterHandle
&& y.TweetId == tweetId2
&& y.Inbox == $"https://{host}{inbox}"
&& y.Inbox == inbox
&& y.Host == host
&& y.PublishedAt != default)))
.ReturnsAsync(-1);
#endregion