activitypub-testing can run tests for Fediverse Enhancement Proposals. Let's use FEP-0f2a as an example:
FEP-0f2a: Announce Activity for Migrations and Tombstone Events is a FEP Specification by bumblefudge.com specifying how ActivityPub Actors can indicate that they have become a Tombstone and/or movedTo/copiedTo another location. @bumblefudge.com also included a FEP Test Specification for a FEP-0f2a Test. This is a human-readable specification of a test procedure that verifies that a test subject implements the normative requirements specified by FEP-0f2a.
@bengo.is later created a FEP Test Implementation for the FEP-0f2a Test in JavaScript and published activitypub-testing-fep-0f2a. The repo also makes the test's JavaScript file available over HTTP, and this URL is used later to instruct activitypub-testing run test to run a test from a remote URL.
activitypub-testing performs Test Runs for the FEP-0f2a Test Implementation.
use activitypub-testing run test with the --url flag set to the URL to the custom test module. activitypub-testing will fetch the URL, load the test, and then apply the test to the input built from the other CLI flags.
activitypub-testing run test \
--url=https://codeberg.org/socialweb.coop/activitypub-testing-fep-0f2a/raw/branch/main/fep-0f2a-actor-object-tombstone-syntax.js \
--input.actor="$(cat <<EOF
{
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/fep/7628"
],
"type": ["Person","Tombstone"],
"inbox": "https://example.com/inbox",
"outbox": "https://example.com/outbox"
}
EOF
)"
{
"type": [
"Assertion"
],
"result": {
"outcome": "passed"
},
"test": {
"slug": "fep-0f2a-actor-object-tombstone-syntax",
"description": "This rule checks whether a given Actor Object has used valid `movedTo` or `copiedTo` values and exclusively.",
"name": "Actor Object Tombstone Syntax",
"id": "urn:uuid:73257c1a-70da-42df-9698-579940c7065a",
"requirementReference": []
},
"input": {
"actor": "{\n \"@context\": [\n \"https://www.w3.org/ns/activitystreams\",\n \"https://w3id.org/fep/7628\"\n ],\n \"type\": [\"Person\",\"Tombstone\"],\n \"inbox\": \"https://example.com/inbox\",\n \"outbox\": \"https://example.com/outbox\"\n}"
},
"@context": [
"https://socialweb.coop/ns/testing/context.json",
"https://www.w3.org/ns/activitystreams"
]
}
Use activitypub-testing run test with the --url flag set to the URL to the custom test module. activitypub-testing will fetch the URL, load the test, and then apply the test to the input built from the other CLI flags. The test accepts an --input.actor JSON string. We can use curl in a shell command substitution to get the URL as an ActivityPub JSON object and substitute that value as --input.actor.
https://socialweb.coopfetchActivityPubActor() {
curl --silent -H 'Accept: application/ld+json; profile="https://www.w3.org/ns/activitystreams"' "$1"
}
testFep0f2aActorUrl() {
activitypub-testing run test \
--url=https://codeberg.org/socialweb.coop/activitypub-testing-fep-0f2a/raw/branch/main/fep-0f2a-actor-object-tombstone-syntax.js \
--input.actor="$(fetchActivityPubActor "$1")"
}
testFep0f2aActorUrl https://socialweb.coop
{
"type": [
"Assertion"
],
"result": {
"outcome": "passed"
},
"test": {
"slug": "fep-0f2a-actor-object-tombstone-syntax",
"description": "This rule checks whether a given Actor Object has used valid `movedTo` or `copiedTo` values and exclusively.",
"name": "Actor Object Tombstone Syntax",
"id": "urn:uuid:73257c1a-70da-42df-9698-579940c7065a",
"requirementReference": []
},
"input": {
"actor": "{\n \"type\": [\n \"Organization\"\n ],\n \"inbox\": \"https://socialweb.coop/inbox\",\n \"outbox\": \"https://socialweb.coop/outbox\",\n \"followers\": {\n \"type\": \"OrderedCollection\",\n \"orderedItems\": []\n },\n \"following\": {\n \"type\": \"OrderedCollection\",\n \"orderedItems\": []\n },\n \"liked\": {\n \"type\": \"OrderedCollection\",\n \"orderedItems\": []\n },\n \"likes\": {\n \"type\": \"OrderedCollection\",\n \"orderedItems\": []\n },\n \"shares\": {\n \"type\": \"OrderedCollection\",\n \"orderedItems\": []\n },\n \"assertionMethod\": [\n {\n \"@context\": \"https://w3id.org/security/multikey/v1\",\n \"id\": \"did:key:zUC7GbgfshTTmWM1V8uy26VKHT52z59519SDxkcg1hdNVSD8NvKPZFnM6R8tG38n2ySQ6zk5JBBQGjfRqy2oi7NgYcoF2LRaE2fHpLWnDvccE1dgfoTkUWAq1AzHZ7jowWC39Ya\",\n \"type\": \"Multikey\",\n \"controller\": \"https://socialweb.coop/\",\n \"publicKeyMultibase\": \"zUC7GbgfshTTmWM1V8uy26VKHT52z59519SDxkcg1hdNVSD8NvKPZFnM6R8tG38n2ySQ6zk5JBBQGjfRqy2oi7NgYcoF2LRaE2fHpLWnDvccE1dgfoTkUWAq1AzHZ7jowWC39Ya\"\n }\n ],\n \"id\": \"https://socialweb.coop/\",\n \"@context\": [\n \"https://www.w3.org/ns/activitystreams\",\n \"https://w3id.org/fep/7628\"\n ]\n}"
},
"@context": [
"https://socialweb.coop/ns/testing/context.json",
"https://www.w3.org/ns/activitystreams"
]
}
activitypub-testing-fedify is a repository that tests an ActivityPub server powered by fedify.dev using activitypub-testing and activitypub-testing-fep-0f2a.
The CI job runs bin/activitypub-testing, which invokes activitypub-testing run test --url=<url-to-fep-0f2a-test>.
GitHub Actions job logs show that the test ran and the result outcome is passed.