diff options
author | Kegsay <kegan@matrix.org> | 2020-05-06 14:27:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-06 14:27:02 +0100 |
commit | 12948522703570e25cd7bacdfdaa81deba988131 (patch) | |
tree | 8ed489313328d26a1882e2e08a2956b3d9d51c59 /federationapi/routing/send.go | |
parent | 1db5dfe4d08b437bfd788eb4ffec09b61b27fd2f (diff) |
Add tests around federationapi's txnReq (#1010)
* Add necessary stubs for testing txnReq
* Add basic tests
Diffstat (limited to 'federationapi/routing/send.go')
-rw-r--r-- | federationapi/routing/send.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/federationapi/routing/send.go b/federationapi/routing/send.go index 0af3cd76..10210db6 100644 --- a/federationapi/routing/send.go +++ b/federationapi/routing/send.go @@ -103,8 +103,17 @@ type txnReq struct { rsAPI api.RoomserverInternalAPI producer *producers.RoomserverProducer eduProducer *producers.EDUServerProducer - keys gomatrixserverlib.KeyRing - federation *gomatrixserverlib.FederationClient + keys gomatrixserverlib.JSONVerifier + federation txnFederationClient +} + +// A subset of FederationClient functionality that txn requires. Useful for testing. +type txnFederationClient interface { + LookupState(ctx context.Context, s gomatrixserverlib.ServerName, roomID string, eventID string, roomVersion gomatrixserverlib.RoomVersion) ( + res gomatrixserverlib.RespState, err error, + ) + LookupStateIDs(ctx context.Context, s gomatrixserverlib.ServerName, roomID string, eventID string) (res gomatrixserverlib.RespStateIDs, err error) + GetEvent(ctx context.Context, s gomatrixserverlib.ServerName, eventID string) (res gomatrixserverlib.Transaction, err error) } func (t *txnReq) processTransaction() (*gomatrixserverlib.RespSend, error) { |