summaryrefslogtreecommitdiff
path: root/internal/db/bundb/timeline_test.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2022-11-15 18:45:15 +0000
committerLibravatar GitHub <noreply@github.com>2022-11-15 18:45:15 +0000
commit8598dea98b872647393117704659878d9b38d4fc (patch)
tree1940168912dc7f54af723439dbc9f6e0a42f30ae /internal/db/bundb/timeline_test.go
parent[docs] Both HTTP proxies and NAT can cause rate limiting issues (#1053) (diff)
downloadgotosocial-8598dea98b872647393117704659878d9b38d4fc.tar.xz
[chore] update database caching library (#1040)
* convert most of the caches to use result.Cache{} * add caching of emojis * fix issues causing failing tests * update go-cache/v2 instances with v3 * fix getnotification * add a note about the left-in StatusCreate comment * update EmojiCategory db access to use new result.Cache{} * fix possible panic in getstatusparents * further proof that kim is not stinky
Diffstat (limited to 'internal/db/bundb/timeline_test.go')
-rw-r--r--internal/db/bundb/timeline_test.go26
1 files changed, 17 insertions, 9 deletions
diff --git a/internal/db/bundb/timeline_test.go b/internal/db/bundb/timeline_test.go
index 9b6365621..066f55234 100644
--- a/internal/db/bundb/timeline_test.go
+++ b/internal/db/bundb/timeline_test.go
@@ -35,44 +35,52 @@ type TimelineTestSuite struct {
}
func (suite *TimelineTestSuite) TestGetPublicTimeline() {
- s, err := suite.db.GetPublicTimeline(context.Background(), "", "", "", 20, false)
+ ctx := context.Background()
+
+ s, err := suite.db.GetPublicTimeline(ctx, "", "", "", 20, false)
suite.NoError(err)
suite.Len(s, 6)
}
func (suite *TimelineTestSuite) TestGetPublicTimelineWithFutureStatus() {
+ ctx := context.Background()
+
futureStatus := getFutureStatus()
- if err := suite.db.Put(context.Background(), futureStatus); err != nil {
- suite.FailNow(err.Error())
- }
+ err := suite.db.PutStatus(ctx, futureStatus)
+ suite.NoError(err)
- s, err := suite.db.GetPublicTimeline(context.Background(), "", "", "", 20, false)
+ s, err := suite.db.GetPublicTimeline(ctx, "", "", "", 20, false)
suite.NoError(err)
+ suite.NotContains(s, futureStatus)
suite.Len(s, 6)
}
func (suite *TimelineTestSuite) TestGetHomeTimeline() {
+ ctx := context.Background()
+
viewingAccount := suite.testAccounts["local_account_1"]
- s, err := suite.db.GetHomeTimeline(context.Background(), viewingAccount.ID, "", "", "", 20, false)
+ s, err := suite.db.GetHomeTimeline(ctx, viewingAccount.ID, "", "", "", 20, false)
suite.NoError(err)
suite.Len(s, 16)
}
func (suite *TimelineTestSuite) TestGetHomeTimelineWithFutureStatus() {
+ ctx := context.Background()
+
viewingAccount := suite.testAccounts["local_account_1"]
futureStatus := getFutureStatus()
- if err := suite.db.Put(context.Background(), futureStatus); err != nil {
- suite.FailNow(err.Error())
- }
+ err := suite.db.PutStatus(ctx, futureStatus)
+ suite.NoError(err)
s, err := suite.db.GetHomeTimeline(context.Background(), viewingAccount.ID, "", "", "", 20, false)
suite.NoError(err)
+ suite.NotContains(s, futureStatus)
suite.Len(s, 16)
}