1
0
Fork 0
forgejo/services
Aravinth Manivannan f9cbea3d6b feat: access ActivityPub client through interfaces to facilitate mocking in unit tests (#4853)
Was facing issues while writing unit tests for federation code. Mocks weren't catching all network calls, because was being out of scope of the mocking infra. Plus, I think we can have more granular tests.

This PR puts the client behind an interface, that can be retrieved from `ctx`. Context doesn't require initialization, as it defaults to the implementation available in-tree. It may be overridden when required (like testing).

## Mechanism

1. Get client factory from `ctx` (factory contains network and crypto parameters that are needed)
2. Initialize client with sender's keys and the receiver's public key
3. Use client as before.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4853
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Aravinth Manivannan <realaravinth@batsense.net>
Co-committed-by: Aravinth Manivannan <realaravinth@batsense.net>
2024-08-07 05:45:24 +00:00
..
actions Clear up old Actions logs (#31735) 2024-08-04 18:24:10 +02:00
agit
asymkey Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
attachment Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
auth Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
automerge
context [BUG] Allow 4 charachter SHA in /src/commit 2024-08-06 01:45:41 +02:00
contexttest Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
convert feat(quota): Humble beginnings of a quota engine 2024-08-02 11:10:34 +02:00
cron Clear up old Actions logs (#31735) 2024-08-04 18:24:10 +02:00
doctor Replace Gitea with Forgejo 2024-07-24 14:17:23 +00:00
externalaccount allow synchronizing user status from OAuth2 login providers (#31572) 2024-07-22 15:44:13 +02:00
f3 Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
federation feat: access ActivityPub client through interfaces to facilitate mocking in unit tests (#4853) 2024-08-07 05:45:24 +00:00
feed Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
forgejo Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
forms Fix: Allow org team names of length 255 in create team form (#31564) 2024-07-14 11:16:34 +02:00
gitdiff feat: highlighted code search results (#4749) 2024-08-06 05:57:25 +00:00
indexer
issue Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
lfs feat(quota): Quota enforcement 2024-08-02 11:10:34 +02:00
mailer Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
markup Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
migrations Update module github.com/google/go-github/v57 to v63 2024-08-05 13:21:39 +00:00
mirror feat(quota): Quota enforcement 2024-08-02 11:10:34 +02:00
notify
org Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
packages Arch packages implementation (#4785) 2024-08-04 06:16:29 +00:00
pull fix: use url.JoinPath to join url parts 2024-07-31 14:45:37 +02:00
release Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
remote
repository Distinguish LFS object errors to ignore missing objects during migration (#31702) 2024-08-04 18:24:10 +02:00
secrets
task feat(quota): Quota enforcement 2024-08-02 11:10:34 +02:00
uinotification
user Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
webhook Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
wiki Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00