diff options
author | 2021-10-10 12:39:25 +0200 | |
---|---|---|
committer | 2021-10-10 12:39:25 +0200 | |
commit | 367bdca25093ee76b36506d8a5e6733b0aa2e2bb (patch) | |
tree | 37b1b82ae6e9fad7e6d95b8abbb58bdb42049707 /internal/federation/federatingdb/federatingdb_test.go | |
parent | Derive visibility fixes (#271) (diff) | |
download | gotosocial-367bdca25093ee76b36506d8a5e6733b0aa2e2bb.tar.xz |
Handle forwarded messages (#273)
* correct path of foss_satan
* add APIri and notes
* test create forward note
* rename target => receiving account
* split up create into separate funcs
* update extractFromCtx
* tidy up from federator processing
* foss satan => http not https
* check if status in db
* mock dereference of status from IRI
* add forward message deref test
* update test with activities
* add remote_account_2 to test rig
Diffstat (limited to 'internal/federation/federatingdb/federatingdb_test.go')
-rw-r--r-- | internal/federation/federatingdb/federatingdb_test.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/federation/federatingdb/federatingdb_test.go b/internal/federation/federatingdb/federatingdb_test.go index fc78540f2..3c22480f7 100644 --- a/internal/federation/federatingdb/federatingdb_test.go +++ b/internal/federation/federatingdb/federatingdb_test.go @@ -19,13 +19,17 @@ package federatingdb_test import ( + "context" + "github.com/sirupsen/logrus" "github.com/stretchr/testify/suite" "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/federation/federatingdb" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" + "github.com/superseriousbusiness/gotosocial/internal/messages" "github.com/superseriousbusiness/gotosocial/internal/typeutils" + "github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/testrig" ) @@ -45,6 +49,7 @@ type FederatingDBTestSuite struct { testAttachments map[string]*gtsmodel.MediaAttachment testStatuses map[string]*gtsmodel.Status testBlocks map[string]*gtsmodel.Block + testActivities map[string]testrig.ActivityWithSignature } func (suite *FederatingDBTestSuite) SetupSuite() { @@ -56,6 +61,7 @@ func (suite *FederatingDBTestSuite) SetupSuite() { suite.testAttachments = testrig.NewTestAttachments() suite.testStatuses = testrig.NewTestStatuses() suite.testBlocks = testrig.NewTestBlocks() + suite.testActivities = testrig.NewTestActivities(suite.testAccounts) } func (suite *FederatingDBTestSuite) SetupTest() { @@ -70,3 +76,11 @@ func (suite *FederatingDBTestSuite) SetupTest() { func (suite *FederatingDBTestSuite) TearDownTest() { testrig.StandardDBTeardown(suite.db) } + +func createTestContext(receivingAccount *gtsmodel.Account, requestingAccount *gtsmodel.Account, fromFederatorChan chan messages.FromFederator) context.Context { + ctx := context.Background() + ctx = context.WithValue(ctx, util.APReceivingAccount, receivingAccount) + ctx = context.WithValue(ctx, util.APRequestingAccount, requestingAccount) + ctx = context.WithValue(ctx, util.APFromFederatorChanKey, fromFederatorChan) + return ctx +} |