diff options
| author | 2025-05-22 12:26:11 +0200 | |
|---|---|---|
| committer | 2025-05-22 12:26:11 +0200 | |
| commit | d5c9c4adc167cdb05e73f5105702cf340293e61c (patch) | |
| tree | 1d21fe376099864900837eba675a965517f98e5d /internal/filter/visibility | |
| parent | [feature] Allow exposing allows, implement `/api/v1/domain_blocks` and `/api/... (diff) | |
| download | gotosocial-d5c9c4adc167cdb05e73f5105702cf340293e61c.tar.xz | |
[chore] Upgrade to Go 1.24 (#4187)
* Set `go.mod` to 1.24 now that it's been out for 3 months.
* Update all the test to use `testing.T.Context()`.
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4187
Co-authored-by: Daenney <git@noreply.sourcery.dny.nu>
Co-committed-by: Daenney <git@noreply.sourcery.dny.nu>
Diffstat (limited to 'internal/filter/visibility')
| -rw-r--r-- | internal/filter/visibility/home_timeline_test.go | 21 | ||||
| -rw-r--r-- | internal/filter/visibility/status_test.go | 21 |
2 files changed, 20 insertions, 22 deletions
diff --git a/internal/filter/visibility/home_timeline_test.go b/internal/filter/visibility/home_timeline_test.go index a152a64bc..d2be788e2 100644 --- a/internal/filter/visibility/home_timeline_test.go +++ b/internal/filter/visibility/home_timeline_test.go @@ -18,7 +18,6 @@ package visibility_test import ( - "context" "testing" "time" @@ -36,7 +35,7 @@ type StatusStatusHomeTimelineableTestSuite struct { func (suite *StatusStatusHomeTimelineableTestSuite) TestOwnStatusHomeTimelineable() { testStatus := suite.testStatuses["local_account_1_status_1"] testAccount := suite.testAccounts["local_account_1"] - ctx := context.Background() + ctx := suite.T().Context() timelineable, err := suite.filter.StatusHomeTimelineable(ctx, testAccount, testStatus) suite.NoError(err) @@ -47,7 +46,7 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestOwnStatusHomeTimelineabl func (suite *StatusStatusHomeTimelineableTestSuite) TestFollowingStatusHomeTimelineable() { testStatus := suite.testStatuses["local_account_2_status_1"] testAccount := suite.testAccounts["local_account_1"] - ctx := context.Background() + ctx := suite.T().Context() timelineable, err := suite.filter.StatusHomeTimelineable(ctx, testAccount, testStatus) suite.NoError(err) @@ -56,7 +55,7 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestFollowingStatusHomeTimel } func (suite *StatusStatusHomeTimelineableTestSuite) TestFollowingBoostedStatusHomeTimelineable() { - ctx := context.Background() + ctx := suite.T().Context() testStatus := suite.testStatuses["admin_account_status_4"] testAccount := suite.testAccounts["local_account_1"] @@ -67,7 +66,7 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestFollowingBoostedStatusHo } func (suite *StatusStatusHomeTimelineableTestSuite) TestFollowingBoostedStatusHomeTimelineableNoReblogs() { - ctx := context.Background() + ctx := suite.T().Context() // Update follow to indicate that local_account_1 // doesn't want to see reblogs by admin_account. @@ -90,7 +89,7 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestFollowingBoostedStatusHo func (suite *StatusStatusHomeTimelineableTestSuite) TestNotFollowingStatusHomeTimelineable() { testStatus := suite.testStatuses["remote_account_1_status_1"] testAccount := suite.testAccounts["local_account_1"] - ctx := context.Background() + ctx := suite.T().Context() timelineable, err := suite.filter.StatusHomeTimelineable(ctx, testAccount, testStatus) suite.NoError(err) @@ -105,7 +104,7 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestStatusTooNewNotTimelinea testStatus.CreatedAt = time.Now().Add(25 * time.Hour) testAccount := suite.testAccounts["local_account_1"] - ctx := context.Background() + ctx := suite.T().Context() timelineable, err := suite.filter.StatusHomeTimelineable(ctx, testAccount, testStatus) suite.NoError(err) @@ -120,7 +119,7 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestStatusNotTooNewTimelinea testStatus.CreatedAt = time.Now().Add(23 * time.Hour) testAccount := suite.testAccounts["local_account_1"] - ctx := context.Background() + ctx := suite.T().Context() timelineable, err := suite.filter.StatusHomeTimelineable(ctx, testAccount, testStatus) suite.NoError(err) @@ -129,7 +128,7 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestStatusNotTooNewTimelinea } func (suite *StatusStatusHomeTimelineableTestSuite) TestThread() { - ctx := context.Background() + ctx := suite.T().Context() threadParentAccount := suite.testAccounts["local_account_1"] timelineOwnerAccount := suite.testAccounts["local_account_2"] @@ -173,7 +172,7 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestThread() { } func (suite *StatusStatusHomeTimelineableTestSuite) TestChainReplyFollowersOnly() { - ctx := context.Background() + ctx := suite.T().Context() // This scenario makes sure that we don't timeline a status which is a followers-only // reply to a followers-only status TO A FOLLOWERS-ONLY STATUS owned by someone the @@ -282,7 +281,7 @@ func (suite *StatusStatusHomeTimelineableTestSuite) TestChainReplyFollowersOnly( } func (suite *StatusStatusHomeTimelineableTestSuite) TestChainReplyPublicAndUnlocked() { - ctx := context.Background() + ctx := suite.T().Context() // This scenario is exactly the same as the above test, but for a mix of unlocked + public posts diff --git a/internal/filter/visibility/status_test.go b/internal/filter/visibility/status_test.go index d7442089c..5abd13065 100644 --- a/internal/filter/visibility/status_test.go +++ b/internal/filter/visibility/status_test.go @@ -18,7 +18,6 @@ package visibility_test import ( - "context" "testing" "code.superseriousbusiness.org/gotosocial/internal/gtsmodel" @@ -33,7 +32,7 @@ type StatusVisibleTestSuite struct { func (suite *StatusVisibleTestSuite) TestOwnStatusVisible() { testStatus := suite.testStatuses["local_account_1_status_1"] testAccount := suite.testAccounts["local_account_1"] - ctx := context.Background() + ctx := suite.T().Context() visible, err := suite.filter.StatusVisible(ctx, testAccount, testStatus) suite.NoError(err) @@ -42,7 +41,7 @@ func (suite *StatusVisibleTestSuite) TestOwnStatusVisible() { } func (suite *StatusVisibleTestSuite) TestOwnDMVisible() { - ctx := context.Background() + ctx := suite.T().Context() testStatusID := suite.testStatuses["local_account_2_status_6"].ID testStatus, err := suite.db.GetStatusByID(ctx, testStatusID) @@ -56,7 +55,7 @@ func (suite *StatusVisibleTestSuite) TestOwnDMVisible() { } func (suite *StatusVisibleTestSuite) TestDMVisibleToTarget() { - ctx := context.Background() + ctx := suite.T().Context() testStatusID := suite.testStatuses["local_account_2_status_6"].ID testStatus, err := suite.db.GetStatusByID(ctx, testStatusID) @@ -70,7 +69,7 @@ func (suite *StatusVisibleTestSuite) TestDMVisibleToTarget() { } func (suite *StatusVisibleTestSuite) TestDMNotVisibleIfNotMentioned() { - ctx := context.Background() + ctx := suite.T().Context() testStatusID := suite.testStatuses["local_account_2_status_6"].ID testStatus, err := suite.db.GetStatusByID(ctx, testStatusID) @@ -84,7 +83,7 @@ func (suite *StatusVisibleTestSuite) TestDMNotVisibleIfNotMentioned() { } func (suite *StatusVisibleTestSuite) TestStatusNotVisibleIfNotMutuals() { - ctx := context.Background() + ctx := suite.T().Context() suite.db.DeleteByID(ctx, suite.testFollows["local_account_2_local_account_1"].ID, >smodel.Follow{}) @@ -100,7 +99,7 @@ func (suite *StatusVisibleTestSuite) TestStatusNotVisibleIfNotMutuals() { } func (suite *StatusVisibleTestSuite) TestStatusNotVisibleIfNotFollowing() { - ctx := context.Background() + ctx := suite.T().Context() suite.db.DeleteByID(ctx, suite.testFollows["admin_account_local_account_1"].ID, >smodel.Follow{}) @@ -116,7 +115,7 @@ func (suite *StatusVisibleTestSuite) TestStatusNotVisibleIfNotFollowing() { } func (suite *StatusVisibleTestSuite) TestStatusNotVisibleIfNotMutualsCached() { - ctx := context.Background() + ctx := suite.T().Context() testStatusID := suite.testStatuses["local_account_1_status_4"].ID testStatus, err := suite.db.GetStatusByID(ctx, testStatusID) suite.NoError(err) @@ -137,7 +136,7 @@ func (suite *StatusVisibleTestSuite) TestStatusNotVisibleIfNotMutualsCached() { } func (suite *StatusVisibleTestSuite) TestStatusNotVisibleIfNotFollowingCached() { - ctx := context.Background() + ctx := suite.T().Context() testStatusID := suite.testStatuses["local_account_1_status_5"].ID testStatus, err := suite.db.GetStatusByID(ctx, testStatusID) suite.NoError(err) @@ -158,7 +157,7 @@ func (suite *StatusVisibleTestSuite) TestStatusNotVisibleIfNotFollowingCached() } func (suite *StatusVisibleTestSuite) TestVisiblePending() { - ctx := context.Background() + ctx := suite.T().Context() // Copy the test status and mark // the copy as pending approval. @@ -241,7 +240,7 @@ func (suite *StatusVisibleTestSuite) TestVisiblePending() { } func (suite *StatusVisibleTestSuite) TestVisibleLocalOnly() { - ctx := context.Background() + ctx := suite.T().Context() // Local-only, Public status. testStatus := suite.testStatuses["local_account_2_status_4"] |
