mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 11:12:24 -06: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
|
|
@ -67,7 +67,7 @@ type AccountStandardTestSuite struct {
|
|||
}
|
||||
|
||||
func (suite *AccountStandardTestSuite) getClientMsg(timeout time.Duration) (*messages.FromClientAPI, bool) {
|
||||
ctx := context.Background()
|
||||
ctx := suite.T().Context()
|
||||
ctx, cncl := context.WithTimeout(ctx, timeout)
|
||||
defer cncl()
|
||||
return suite.state.Workers.Client.Queue.PopCtx(ctx)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
package account_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"slices"
|
||||
"testing"
|
||||
|
||||
|
|
@ -145,7 +144,7 @@ func (suite *AliasTestSuite) TestAliasAccount() {
|
|||
},
|
||||
} {
|
||||
var (
|
||||
ctx = context.Background()
|
||||
ctx = suite.T().Context()
|
||||
testAcct = new(gtsmodel.Account)
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
package account_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"testing"
|
||||
"time"
|
||||
|
|
@ -32,7 +31,7 @@ type AccountDeleteTestSuite struct {
|
|||
}
|
||||
|
||||
func (suite *AccountDeleteTestSuite) TestAccountDeleteLocal() {
|
||||
ctx := context.Background()
|
||||
ctx := suite.T().Context()
|
||||
|
||||
// Keep a reference around to the original account
|
||||
// and user, before the delete was processed.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
package account_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
|
@ -33,7 +32,7 @@ type FollowTestSuite struct {
|
|||
}
|
||||
|
||||
func (suite *FollowTestSuite) TestUpdateExistingFollowChangeBoth() {
|
||||
ctx := context.Background()
|
||||
ctx := suite.T().Context()
|
||||
requestingAccount := suite.testAccounts["local_account_1"]
|
||||
targetAccount := suite.testAccounts["admin_account"]
|
||||
|
||||
|
|
@ -54,7 +53,7 @@ func (suite *FollowTestSuite) TestUpdateExistingFollowChangeBoth() {
|
|||
}
|
||||
|
||||
func (suite *FollowTestSuite) TestUpdateExistingFollowChangeNotifyIgnoreReblogs() {
|
||||
ctx := context.Background()
|
||||
ctx := suite.T().Context()
|
||||
requestingAccount := suite.testAccounts["local_account_1"]
|
||||
targetAccount := suite.testAccounts["admin_account"]
|
||||
|
||||
|
|
@ -74,7 +73,7 @@ func (suite *FollowTestSuite) TestUpdateExistingFollowChangeNotifyIgnoreReblogs(
|
|||
}
|
||||
|
||||
func (suite *FollowTestSuite) TestUpdateExistingFollowChangeNotifySetReblogs() {
|
||||
ctx := context.Background()
|
||||
ctx := suite.T().Context()
|
||||
requestingAccount := suite.testAccounts["local_account_1"]
|
||||
targetAccount := suite.testAccounts["admin_account"]
|
||||
|
||||
|
|
@ -95,7 +94,7 @@ func (suite *FollowTestSuite) TestUpdateExistingFollowChangeNotifySetReblogs() {
|
|||
}
|
||||
|
||||
func (suite *FollowTestSuite) TestUpdateExistingFollowChangeNothing() {
|
||||
ctx := context.Background()
|
||||
ctx := suite.T().Context()
|
||||
requestingAccount := suite.testAccounts["local_account_1"]
|
||||
targetAccount := suite.testAccounts["admin_account"]
|
||||
|
||||
|
|
@ -115,7 +114,7 @@ func (suite *FollowTestSuite) TestUpdateExistingFollowChangeNothing() {
|
|||
}
|
||||
|
||||
func (suite *FollowTestSuite) TestUpdateExistingFollowSetNothing() {
|
||||
ctx := context.Background()
|
||||
ctx := suite.T().Context()
|
||||
requestingAccount := suite.testAccounts["local_account_1"]
|
||||
targetAccount := suite.testAccounts["admin_account"]
|
||||
|
||||
|
|
@ -133,7 +132,7 @@ func (suite *FollowTestSuite) TestUpdateExistingFollowSetNothing() {
|
|||
}
|
||||
|
||||
func (suite *FollowTestSuite) TestFollowRequestLocal() {
|
||||
ctx := context.Background()
|
||||
ctx := suite.T().Context()
|
||||
requestingAccount := suite.testAccounts["admin_account"]
|
||||
targetAccount := suite.testAccounts["local_account_2"]
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
package account_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
|
@ -34,7 +33,7 @@ type MoveTestSuite struct {
|
|||
}
|
||||
|
||||
func (suite *MoveTestSuite) TestMoveAccountOK() {
|
||||
ctx := context.Background()
|
||||
ctx := suite.T().Context()
|
||||
|
||||
// Copy zork.
|
||||
requestingAcct := new(gtsmodel.Account)
|
||||
|
|
@ -106,7 +105,7 @@ func (suite *MoveTestSuite) TestMoveAccountOK() {
|
|||
}
|
||||
|
||||
func (suite *MoveTestSuite) TestMoveAccountNotAliased() {
|
||||
ctx := context.Background()
|
||||
ctx := suite.T().Context()
|
||||
|
||||
// Copy zork.
|
||||
requestingAcct := new(gtsmodel.Account)
|
||||
|
|
@ -136,7 +135,7 @@ func (suite *MoveTestSuite) TestMoveAccountNotAliased() {
|
|||
}
|
||||
|
||||
func (suite *MoveTestSuite) TestMoveAccountBadPassword() {
|
||||
ctx := context.Background()
|
||||
ctx := suite.T().Context()
|
||||
|
||||
// Copy zork.
|
||||
requestingAcct := new(gtsmodel.Account)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
package account_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
|
@ -29,7 +28,7 @@ type GetRSSTestSuite struct {
|
|||
}
|
||||
|
||||
func (suite *GetRSSTestSuite) TestGetAccountRSSAdmin() {
|
||||
getFeed, lastModified, err := suite.accountProcessor.GetRSSFeedForUsername(context.Background(), "admin")
|
||||
getFeed, lastModified, err := suite.accountProcessor.GetRSSFeedForUsername(suite.T().Context(), "admin")
|
||||
suite.NoError(err)
|
||||
suite.EqualValues(1634726497, lastModified.Unix())
|
||||
|
||||
|
|
@ -68,7 +67,7 @@ func (suite *GetRSSTestSuite) TestGetAccountRSSAdmin() {
|
|||
}
|
||||
|
||||
func (suite *GetRSSTestSuite) TestGetAccountRSSZork() {
|
||||
getFeed, lastModified, err := suite.accountProcessor.GetRSSFeedForUsername(context.Background(), "the_mighty_zork")
|
||||
getFeed, lastModified, err := suite.accountProcessor.GetRSSFeedForUsername(suite.T().Context(), "the_mighty_zork")
|
||||
suite.NoError(err)
|
||||
suite.EqualValues(1730451600, lastModified.Unix())
|
||||
|
||||
|
|
@ -156,7 +155,7 @@ func (suite *GetRSSTestSuite) TestGetAccountRSSZork() {
|
|||
}
|
||||
|
||||
func (suite *GetRSSTestSuite) TestGetAccountRSSZorkNoPosts() {
|
||||
ctx := context.Background()
|
||||
ctx := suite.T().Context()
|
||||
|
||||
// Get all of zork's posts.
|
||||
statuses, err := suite.db.GetAccountStatuses(ctx, suite.testAccounts["local_account_1"].ID, 0, false, false, "", "", false, false)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
package account_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
|
@ -38,7 +37,7 @@ func (suite *AccountUpdateTestSuite) TestAccountUpdateSimple() {
|
|||
*testAccount = *suite.testAccounts["local_account_1"]
|
||||
|
||||
var (
|
||||
ctx = context.Background()
|
||||
ctx = suite.T().Context()
|
||||
locked = true
|
||||
displayName = "new display name"
|
||||
note = "#hello here i am!"
|
||||
|
|
@ -88,7 +87,7 @@ func (suite *AccountUpdateTestSuite) TestAccountUpdateWithMention() {
|
|||
*testAccount = *suite.testAccounts["local_account_1"]
|
||||
|
||||
var (
|
||||
ctx = context.Background()
|
||||
ctx = suite.T().Context()
|
||||
locked = true
|
||||
displayName = "new display name"
|
||||
note = "#hello here i am!\n\ngo check out @1happyturtle, they have a cool account!"
|
||||
|
|
@ -144,7 +143,7 @@ func (suite *AccountUpdateTestSuite) TestAccountUpdateWithMarkdownNote() {
|
|||
testAccount.Settings = settings
|
||||
|
||||
var (
|
||||
ctx = context.Background()
|
||||
ctx = suite.T().Context()
|
||||
note = "*hello* ~~here~~ i am!"
|
||||
noteExpected = `<p><em>hello</em> <del>here</del> i am!</p>`
|
||||
)
|
||||
|
|
@ -193,7 +192,7 @@ func (suite *AccountUpdateTestSuite) TestAccountUpdateWithFields() {
|
|||
*testAccount = *suite.testAccounts["local_account_1"]
|
||||
|
||||
var (
|
||||
ctx = context.Background()
|
||||
ctx = suite.T().Context()
|
||||
updateFields = []apimodel.UpdateField{
|
||||
{
|
||||
Name: func() *string { s := "favourite emoji"; return &s }(),
|
||||
|
|
@ -287,7 +286,7 @@ func (suite *AccountUpdateTestSuite) TestAccountUpdateNoteNotFields() {
|
|||
*testAccount = *suite.testAccounts["local_account_2"]
|
||||
|
||||
var (
|
||||
ctx = context.Background()
|
||||
ctx = suite.T().Context()
|
||||
fieldsRawBefore = len(testAccount.FieldsRaw)
|
||||
fieldsBefore = len(testAccount.Fields)
|
||||
note = "#hello here i am!"
|
||||
|
|
@ -335,7 +334,7 @@ func (suite *AccountUpdateTestSuite) TestAccountUpdateNoteNotFields() {
|
|||
func (suite *AccountUpdateTestSuite) TestAccountUpdateBotNotBot() {
|
||||
testAccount := >smodel.Account{}
|
||||
*testAccount = *suite.testAccounts["local_account_1"]
|
||||
ctx := context.Background()
|
||||
ctx := suite.T().Context()
|
||||
|
||||
// Call update function to set bot = true.
|
||||
apiAccount, errWithCode := suite.accountProcessor.Update(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue