summaryrefslogtreecommitdiff
path: root/internal/processing/conversations
diff options
context:
space:
mode:
Diffstat (limited to 'internal/processing/conversations')
-rw-r--r--internal/processing/conversations/conversations_test.go6
-rw-r--r--internal/processing/conversations/delete_test.go4
-rw-r--r--internal/processing/conversations/get_test.go7
-rw-r--r--internal/processing/conversations/migrate_test.go4
-rw-r--r--internal/processing/conversations/read_test.go4
-rw-r--r--internal/processing/conversations/update_test.go6
6 files changed, 10 insertions, 21 deletions
diff --git a/internal/processing/conversations/conversations_test.go b/internal/processing/conversations/conversations_test.go
index 0f96ecbac..40145c2fb 100644
--- a/internal/processing/conversations/conversations_test.go
+++ b/internal/processing/conversations/conversations_test.go
@@ -75,7 +75,7 @@ type ConversationsTestSuite struct {
}
func (suite *ConversationsTestSuite) 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)
@@ -130,8 +130,8 @@ func (suite *ConversationsTestSuite) TearDownTest() {
(*gtsmodel.ConversationToStatus)(nil),
}
for _, model := range conversationModels {
- if err := suite.db.DropTable(context.Background(), model); err != nil {
- log.Error(context.Background(), err)
+ if err := suite.db.DropTable(suite.T().Context(), model); err != nil {
+ log.Error(suite.T().Context(), err)
}
}
diff --git a/internal/processing/conversations/delete_test.go b/internal/processing/conversations/delete_test.go
index 23b4f1c1a..d3d8d47a6 100644
--- a/internal/processing/conversations/delete_test.go
+++ b/internal/processing/conversations/delete_test.go
@@ -17,11 +17,9 @@
package conversations_test
-import "context"
-
func (suite *ConversationsTestSuite) TestDelete() {
conversation := suite.NewTestConversation(suite.testAccount, 0)
- err := suite.conversationsProcessor.Delete(context.Background(), suite.testAccount, conversation.ID)
+ err := suite.conversationsProcessor.Delete(suite.T().Context(), suite.testAccount, conversation.ID)
suite.NoError(err)
}
diff --git a/internal/processing/conversations/get_test.go b/internal/processing/conversations/get_test.go
index ea8794601..9106c930c 100644
--- a/internal/processing/conversations/get_test.go
+++ b/internal/processing/conversations/get_test.go
@@ -18,7 +18,6 @@
package conversations_test
import (
- "context"
"time"
apimodel "code.superseriousbusiness.org/gotosocial/internal/api/model"
@@ -27,7 +26,7 @@ import (
func (suite *ConversationsTestSuite) TestGetAll() {
conversation := suite.NewTestConversation(suite.testAccount, 0)
- resp, err := suite.conversationsProcessor.GetAll(context.Background(), suite.testAccount, nil)
+ resp, err := suite.conversationsProcessor.GetAll(suite.T().Context(), suite.testAccount, nil)
if suite.NoError(err) && suite.Len(resp.Items, 1) && suite.IsType((*apimodel.Conversation)(nil), resp.Items[0]) {
apiConversation := resp.Items[0].(*apimodel.Conversation)
suite.Equal(conversation.ID, apiConversation.ID)
@@ -46,11 +45,11 @@ func (suite *ConversationsTestSuite) TestGetAllOrder() {
// Add an even newer status than that to conversation1.
conversation1Status2 := suite.NewTestStatus(suite.testAccount, conversation1.LastStatus.ThreadID, 2*time.Second, conversation1.LastStatus)
conversation1.LastStatusID = conversation1Status2.ID
- if err := suite.db.UpsertConversation(context.Background(), conversation1, "last_status_id"); err != nil {
+ if err := suite.db.UpsertConversation(suite.T().Context(), conversation1, "last_status_id"); err != nil {
suite.FailNow(err.Error())
}
- resp, err := suite.conversationsProcessor.GetAll(context.Background(), suite.testAccount, nil)
+ resp, err := suite.conversationsProcessor.GetAll(suite.T().Context(), suite.testAccount, nil)
if suite.NoError(err) && suite.Len(resp.Items, 2) {
// conversation1 should be the first conversation returned.
apiConversation1 := resp.Items[0].(*apimodel.Conversation)
diff --git a/internal/processing/conversations/migrate_test.go b/internal/processing/conversations/migrate_test.go
index 7253b30a6..a6e506e49 100644
--- a/internal/processing/conversations/migrate_test.go
+++ b/internal/processing/conversations/migrate_test.go
@@ -18,8 +18,6 @@
package conversations_test
import (
- "context"
-
"code.superseriousbusiness.org/gotosocial/internal/db"
"code.superseriousbusiness.org/gotosocial/internal/db/bundb"
"code.superseriousbusiness.org/gotosocial/internal/gtsmodel"
@@ -29,7 +27,7 @@ import (
// This test assumes that we're using the standard test fixtures, which contain some conversation-eligible DMs.
func (suite *ConversationsTestSuite) TestMigrateDMsToConversations() {
advancedMigrationID := "20240611190733_add_conversations"
- ctx := context.Background()
+ ctx := suite.T().Context()
rawDB := (suite.db).(*bundb.DBService).DB()
// Precondition: we shouldn't have any conversations yet.
diff --git a/internal/processing/conversations/read_test.go b/internal/processing/conversations/read_test.go
index 3b86326fd..a15ddcca3 100644
--- a/internal/processing/conversations/read_test.go
+++ b/internal/processing/conversations/read_test.go
@@ -18,8 +18,6 @@
package conversations_test
import (
- "context"
-
"code.superseriousbusiness.org/gotosocial/internal/util"
)
@@ -27,7 +25,7 @@ func (suite *ConversationsTestSuite) TestRead() {
conversation := suite.NewTestConversation(suite.testAccount, 0)
suite.False(util.PtrOrValue(conversation.Read, false))
- apiConversation, err := suite.conversationsProcessor.Read(context.Background(), suite.testAccount, conversation.ID)
+ apiConversation, err := suite.conversationsProcessor.Read(suite.T().Context(), suite.testAccount, conversation.ID)
if suite.NoError(err) {
suite.False(apiConversation.Unread)
}
diff --git a/internal/processing/conversations/update_test.go b/internal/processing/conversations/update_test.go
index 8ba2800fe..b547fae7c 100644
--- a/internal/processing/conversations/update_test.go
+++ b/internal/processing/conversations/update_test.go
@@ -17,13 +17,9 @@
package conversations_test
-import (
- "context"
-)
-
// Test that we can create conversations when a new status comes in.
func (suite *ConversationsTestSuite) TestUpdateConversationsForStatus() {
- ctx := context.Background()
+ ctx := suite.T().Context()
// Precondition: the test user shouldn't have any conversations yet.
conversations, err := suite.db.GetConversationsByOwnerAccountID(ctx, suite.testAccount.ID, nil)