summaryrefslogtreecommitdiff
path: root/internal/ap/ap_test.go
diff options
context:
space:
mode:
authorLibravatar Daenney <git@noreply.sourcery.dny.nu>2025-05-22 12:26:11 +0200
committerLibravatar kim <gruf@noreply.codeberg.org>2025-05-22 12:26:11 +0200
commitd5c9c4adc167cdb05e73f5105702cf340293e61c (patch)
tree1d21fe376099864900837eba675a965517f98e5d /internal/ap/ap_test.go
parent[feature] Allow exposing allows, implement `/api/v1/domain_blocks` and `/api/... (diff)
downloadgotosocial-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/ap/ap_test.go')
-rw-r--r--internal/ap/ap_test.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/internal/ap/ap_test.go b/internal/ap/ap_test.go
index 06856812c..0956fee66 100644
--- a/internal/ap/ap_test.go
+++ b/internal/ap/ap_test.go
@@ -19,9 +19,9 @@ package ap_test
import (
"bytes"
- "context"
"encoding/json"
"io"
+ "testing"
"code.superseriousbusiness.org/activity/streams"
"code.superseriousbusiness.org/activity/streams/vocab"
@@ -250,7 +250,7 @@ func (suite *APTestSuite) noteWithHashtags1() ap.Statusable {
}`)
statusable, err := ap.ResolveStatusable(
- context.Background(),
+ suite.T().Context(),
io.NopCloser(bytes.NewReader(noteJson)),
)
if err != nil {
@@ -306,7 +306,7 @@ func addressable3() ap.Addressable {
return note
}
-func addressable4() vocab.ActivityStreamsAnnounce {
+func addressable4(t *testing.T) vocab.ActivityStreamsAnnounce {
// https://codeberg.org/superseriousbusiness/gotosocial/issues/267
announceJson := []byte(`
{
@@ -326,12 +326,12 @@ func addressable4() vocab.ActivityStreamsAnnounce {
panic(err)
}
- t, err := streams.ToType(context.Background(), jsonAsMap)
+ typ, err := streams.ToType(t.Context(), jsonAsMap)
if err != nil {
panic(err)
}
- return t.(vocab.ActivityStreamsAnnounce)
+ return typ.(vocab.ActivityStreamsAnnounce)
}
func addressable5() ap.Addressable {
@@ -366,7 +366,7 @@ func (suite *APTestSuite) jsonToType(rawJson string) (vocab.Type, map[string]int
panic(err)
}
- t, err := streams.ToType(context.Background(), raw)
+ t, err := streams.ToType(suite.T().Context(), raw)
if err != nil {
panic(err)
}
@@ -395,7 +395,7 @@ func (suite *APTestSuite) SetupTest() {
suite.addressable1 = addressable1()
suite.addressable2 = addressable2()
suite.addressable3 = addressable3()
- suite.addressable4 = addressable4()
+ suite.addressable4 = addressable4(suite.T())
suite.addressable5 = addressable5()
suite.testAccounts = testrig.NewTestAccounts()
}