diff options
Diffstat (limited to 'internal/db/bundb/search_test.go')
| -rw-r--r-- | internal/db/bundb/search_test.go | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/internal/db/bundb/search_test.go b/internal/db/bundb/search_test.go index 5ce1a6064..c864f6da2 100644 --- a/internal/db/bundb/search_test.go +++ b/internal/db/bundb/search_test.go @@ -18,7 +18,6 @@ package bundb_test import ( - "context" "testing" "code.superseriousbusiness.org/gotosocial/internal/db" @@ -32,7 +31,7 @@ type SearchTestSuite struct { func (suite *SearchTestSuite) TestSearchAccountsTurtleAny() { testAccount := suite.testAccounts["local_account_1"] - accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "turtle", "", "", 10, false, 0) + accounts, err := suite.db.SearchForAccounts(suite.T().Context(), testAccount.ID, "turtle", "", "", 10, false, 0) suite.NoError(err) suite.Len(accounts, 1) } @@ -41,7 +40,7 @@ func (suite *SearchTestSuite) TestSearchAccounts1HappyWithPrefix() { testAccount := suite.testAccounts["local_account_1"] // Query will just look for usernames that start with "1happy". - accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "@1happy", "", "", 10, false, 0) + accounts, err := suite.db.SearchForAccounts(suite.T().Context(), testAccount.ID, "@1happy", "", "", 10, false, 0) suite.NoError(err) suite.Len(accounts, 1) } @@ -50,7 +49,7 @@ func (suite *SearchTestSuite) TestSearchAccounts1HappyWithPrefixUpper() { testAccount := suite.testAccounts["local_account_1"] // Query will just look for usernames that start with "1HAPPY". - accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "@1HAPPY", "", "", 10, false, 0) + accounts, err := suite.db.SearchForAccounts(suite.T().Context(), testAccount.ID, "@1HAPPY", "", "", 10, false, 0) suite.NoError(err) suite.Len(accounts, 1) } @@ -59,7 +58,7 @@ func (suite *SearchTestSuite) TestSearchAccounts1HappyNoPrefix() { testAccount := suite.testAccounts["local_account_1"] // Query will do the full coalesce. - accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "1happy", "", "", 10, false, 0) + accounts, err := suite.db.SearchForAccounts(suite.T().Context(), testAccount.ID, "1happy", "", "", 10, false, 0) suite.NoError(err) suite.Len(accounts, 1) } @@ -67,7 +66,7 @@ func (suite *SearchTestSuite) TestSearchAccounts1HappyNoPrefix() { func (suite *SearchTestSuite) TestSearchAccountsTurtleFollowing() { testAccount := suite.testAccounts["local_account_1"] - accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "turtle", "", "", 10, true, 0) + accounts, err := suite.db.SearchForAccounts(suite.T().Context(), testAccount.ID, "turtle", "", "", 10, true, 0) suite.NoError(err) suite.Len(accounts, 1) } @@ -75,7 +74,7 @@ func (suite *SearchTestSuite) TestSearchAccountsTurtleFollowing() { func (suite *SearchTestSuite) TestSearchAccountsTurtleFollowingUpper() { testAccount := suite.testAccounts["local_account_1"] - accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "TURTLE", "", "", 10, true, 0) + accounts, err := suite.db.SearchForAccounts(suite.T().Context(), testAccount.ID, "TURTLE", "", "", 10, true, 0) suite.NoError(err) suite.Len(accounts, 1) } @@ -83,7 +82,7 @@ func (suite *SearchTestSuite) TestSearchAccountsTurtleFollowingUpper() { func (suite *SearchTestSuite) TestSearchAccountsPostFollowing() { testAccount := suite.testAccounts["local_account_1"] - accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "post", "", "", 10, true, 0) + accounts, err := suite.db.SearchForAccounts(suite.T().Context(), testAccount.ID, "post", "", "", 10, true, 0) suite.NoError(err) suite.Len(accounts, 1) } @@ -91,7 +90,7 @@ func (suite *SearchTestSuite) TestSearchAccountsPostFollowing() { func (suite *SearchTestSuite) TestSearchAccountsPostAny() { testAccount := suite.testAccounts["local_account_1"] - accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "post", "", "", 10, false, 0) + accounts, err := suite.db.SearchForAccounts(suite.T().Context(), testAccount.ID, "post", "", "", 10, false, 0) suite.NoError(err, db.ErrNoEntries) suite.Empty(accounts) } @@ -99,7 +98,7 @@ func (suite *SearchTestSuite) TestSearchAccountsPostAny() { func (suite *SearchTestSuite) TestSearchAccountsFossAny() { testAccount := suite.testAccounts["local_account_1"] - accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "foss", "", "", 10, false, 0) + accounts, err := suite.db.SearchForAccounts(suite.T().Context(), testAccount.ID, "foss", "", "", 10, false, 0) suite.NoError(err) suite.Len(accounts, 1) } @@ -107,7 +106,7 @@ func (suite *SearchTestSuite) TestSearchAccountsFossAny() { func (suite *SearchTestSuite) TestSearchStatuses() { testAccount := suite.testAccounts["local_account_1"] - statuses, err := suite.db.SearchForStatuses(context.Background(), testAccount.ID, "hello", "", "", "", 10, 0) + statuses, err := suite.db.SearchForStatuses(suite.T().Context(), testAccount.ID, "hello", "", "", "", 10, 0) suite.NoError(err) suite.Len(statuses, 1) } @@ -116,7 +115,7 @@ func (suite *SearchTestSuite) TestSearchStatusesFromAccount() { testAccount := suite.testAccounts["local_account_1"] fromAccount := suite.testAccounts["local_account_2"] - statuses, err := suite.db.SearchForStatuses(context.Background(), testAccount.ID, "hi", fromAccount.ID, "", "", 10, 0) + statuses, err := suite.db.SearchForStatuses(suite.T().Context(), testAccount.ID, "hi", fromAccount.ID, "", "", 10, 0) suite.NoError(err) if suite.Len(statuses, 1) { suite.Equal(fromAccount.ID, statuses[0].AccountID) @@ -125,17 +124,17 @@ func (suite *SearchTestSuite) TestSearchStatusesFromAccount() { func (suite *SearchTestSuite) TestSearchTags() { // Search with full tag string. - tags, err := suite.db.SearchForTags(context.Background(), "welcome", "", "", 10, 0) + tags, err := suite.db.SearchForTags(suite.T().Context(), "welcome", "", "", 10, 0) suite.NoError(err) suite.Len(tags, 1) // Search with partial tag string. - tags, err = suite.db.SearchForTags(context.Background(), "wel", "", "", 10, 0) + tags, err = suite.db.SearchForTags(suite.T().Context(), "wel", "", "", 10, 0) suite.NoError(err) suite.Len(tags, 1) // Search with end of tag string. - tags, err = suite.db.SearchForTags(context.Background(), "come", "", "", 10, 0) + tags, err = suite.db.SearchForTags(suite.T().Context(), "come", "", "", 10, 0) suite.NoError(err) suite.Len(tags, 0) } |
