mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 06:52:25 -05:00
[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>
This commit is contained in:
parent
ec4d4d0115
commit
d5c9c4adc1
175 changed files with 857 additions and 1004 deletions
|
|
@ -19,7 +19,6 @@ package spam_test
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
|
|
@ -621,7 +620,7 @@ const (
|
|||
|
||||
func (suite *StatusableTestSuite) TestStatusableOK() {
|
||||
var (
|
||||
ctx = context.Background()
|
||||
ctx = suite.T().Context()
|
||||
receiver = suite.testAccounts["local_account_1"]
|
||||
requester = suite.testAccounts["remote_account_1"]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue