diff options
| author | 2025-05-22 12:26:11 +0200 | |
|---|---|---|
| committer | 2025-05-22 12:26:11 +0200 | |
| commit | d5c9c4adc167cdb05e73f5105702cf340293e61c (patch) | |
| tree | 1d21fe376099864900837eba675a965517f98e5d /internal/processing/account | |
| 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/processing/account')
| -rw-r--r-- | internal/processing/account/account_test.go | 2 | ||||
| -rw-r--r-- | internal/processing/account/alias_test.go | 3 | ||||
| -rw-r--r-- | internal/processing/account/delete_test.go | 3 | ||||
| -rw-r--r-- | internal/processing/account/follow_test.go | 13 | ||||
| -rw-r--r-- | internal/processing/account/move_test.go | 7 | ||||
| -rw-r--r-- | internal/processing/account/rss_test.go | 7 | ||||
| -rw-r--r-- | internal/processing/account/update_test.go | 13 |
7 files changed, 21 insertions, 27 deletions
diff --git a/internal/processing/account/account_test.go b/internal/processing/account/account_test.go index 5c80922e6..4af63d1b3 100644 --- a/internal/processing/account/account_test.go +++ b/internal/processing/account/account_test.go @@ -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) diff --git a/internal/processing/account/alias_test.go b/internal/processing/account/alias_test.go index f3231cd74..fef2335ec 100644 --- a/internal/processing/account/alias_test.go +++ b/internal/processing/account/alias_test.go @@ -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) ) diff --git a/internal/processing/account/delete_test.go b/internal/processing/account/delete_test.go index fd19099c3..93bc1f9c4 100644 --- a/internal/processing/account/delete_test.go +++ b/internal/processing/account/delete_test.go @@ -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. diff --git a/internal/processing/account/follow_test.go b/internal/processing/account/follow_test.go index 68653f329..d68d8d065 100644 --- a/internal/processing/account/follow_test.go +++ b/internal/processing/account/follow_test.go @@ -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"] diff --git a/internal/processing/account/move_test.go b/internal/processing/account/move_test.go index 54b016528..55d6548db 100644 --- a/internal/processing/account/move_test.go +++ b/internal/processing/account/move_test.go @@ -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) diff --git a/internal/processing/account/rss_test.go b/internal/processing/account/rss_test.go index 9b6b1ee75..0b64e8464 100644 --- a/internal/processing/account/rss_test.go +++ b/internal/processing/account/rss_test.go @@ -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) diff --git a/internal/processing/account/update_test.go b/internal/processing/account/update_test.go index 52895a463..b6e315d41 100644 --- a/internal/processing/account/update_test.go +++ b/internal/processing/account/update_test.go @@ -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( |
