diff options
author | 2021-05-15 11:58:11 +0200 | |
---|---|---|
committer | 2021-05-15 11:58:11 +0200 | |
commit | cc48294c31a76e94fa879ad0d8d5dbd7e94c651b (patch) | |
tree | 7c26d33b41bab33bbdfbba540958444f4c296602 /testrig | |
parent | Mediahandler (#21) (diff) | |
download | gotosocial-cc48294c31a76e94fa879ad0d8d5dbd7e94c651b.tar.xz |
Inbox post (#22)
Inbox POST from federated servers now working for statuses and follow requests.
Follow request client API added.
Start work on federating outgoing messages.
Other fixes and changes/tidying up.
Diffstat (limited to 'testrig')
-rw-r--r-- | testrig/db.go | 3 | ||||
-rw-r--r-- | testrig/federator.go | 1 | ||||
-rw-r--r-- | testrig/testmodels.go | 8 |
3 files changed, 8 insertions, 4 deletions
diff --git a/testrig/db.go b/testrig/db.go index 4d22ab3c8..0b4920191 100644 --- a/testrig/db.go +++ b/testrig/db.go @@ -23,6 +23,7 @@ import ( "github.com/sirupsen/logrus" "github.com/superseriousbusiness/gotosocial/internal/db" + "github.com/superseriousbusiness/gotosocial/internal/db/pg" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/oauth" ) @@ -54,7 +55,7 @@ func NewTestDB() db.DB { config := NewTestConfig() l := logrus.New() l.SetLevel(logrus.TraceLevel) - testDB, err := db.NewPostgresService(context.Background(), config, l) + testDB, err := pg.NewPostgresService(context.Background(), config, l) if err != nil { panic(err) } diff --git a/testrig/federator.go b/testrig/federator.go index 63ad520db..c2d86fd21 100644 --- a/testrig/federator.go +++ b/testrig/federator.go @@ -24,6 +24,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/transport" ) +// NewTestFederator returns a federator with the given database and (mock!!) transport controller. func NewTestFederator(db db.DB, tc transport.Controller) federation.Federator { return federation.NewFederator(db, tc, NewTestConfig(), NewTestLog(), NewTestTypeConverter(db)) } diff --git a/testrig/testmodels.go b/testrig/testmodels.go index 6d7390729..90d7f63b6 100644 --- a/testrig/testmodels.go +++ b/testrig/testmodels.go @@ -1037,6 +1037,7 @@ func NewTestFaves() map[string]*gtsmodel.StatusFave { } } +// ActivityWithSignature wraps a pub.Activity along with its signature headers, for testing. type ActivityWithSignature struct { Activity pub.Activity SignatureHeader string @@ -1076,11 +1077,11 @@ func NewTestActivities(accounts map[string]*gtsmodel.Account) map[string]Activit // NewTestFediPeople returns a bunch of activity pub Person representations for testing converters and so on. func NewTestFediPeople() map[string]typeutils.Accountable { - new_person_1priv, err := rsa.GenerateKey(rand.Reader, 2048) + newPerson1Priv, err := rsa.GenerateKey(rand.Reader, 2048) if err != nil { panic(err) } - new_person_1pub := &new_person_1priv.PublicKey + newPerson1Pub := &newPerson1Priv.PublicKey return map[string]typeutils.Accountable{ "new_person_1": newPerson( @@ -1096,7 +1097,7 @@ func NewTestFediPeople() map[string]typeutils.Accountable { URLMustParse("https://unknown-instance.com/@brand_new_person"), true, URLMustParse("https://unknown-instance.com/users/brand_new_person#main-key"), - new_person_1pub, + newPerson1Pub, URLMustParse("https://unknown-instance.com/media/some_avatar_filename.jpeg"), "image/jpeg", URLMustParse("https://unknown-instance.com/media/some_header_filename.jpeg"), @@ -1105,6 +1106,7 @@ func NewTestFediPeople() map[string]typeutils.Accountable { } } +// NewTestDereferenceRequests returns a map of incoming dereference requests, with their signatures. func NewTestDereferenceRequests(accounts map[string]*gtsmodel.Account) map[string]ActivityWithSignature { sig, digest, date := getSignatureForDereference(accounts["remote_account_1"].PublicKeyURI, accounts["remote_account_1"].PrivateKey, URLMustParse(accounts["local_account_1"].URI)) return map[string]ActivityWithSignature{ |