Check that outbox post server added to outbox collection by getting the outbox collection and looking in the items

Description

a test rule that sends a submission to an outbox then gets the outbox and expects to find the submitted activity

Table of Contents

Identifiers

Use these identifiers to refer to this Test.

URI

urn:uuid:43d3465d-6f5a-47c2-99ad-44bd883472b3

slug

This slug is memorable, but it is not guaranteed to be globally unique like a URI.

outbox-post-server-adds-to-outbox-collection-checked-by-outbox-get

Input

This describes the input that each test run will use to select test targets.

input.outbox

the url to the Outbox handling an Activity POST request

required
true
type
xsd:anyUri
range
https://www.w3.org/ns/activitystreams#outbox

input.outbox as json
{
  "help": "the url to the Outbox handling an Activity POST request",
  "required": true,
  "type": "xsd:anyUri",
  "rangeIncludes": [
    "https://www.w3.org/ns/activitystreams#outbox"
  ]
}

input.authorization

HTTP Authorization header value to include in outbox POST request

required
false
type
xsd:string, https://activitypub-testing.socialweb.coop/ns/HiddenInTestResults
range
https://www.rfc-editor.org/rfc/rfc9110#field.authorization.value

input.authorization as json
{
  "help": "HTTP Authorization header value to include in outbox POST request",
  "required": false,
  "type": [
    "xsd:string",
    "https://activitypub-testing.socialweb.coop/ns/HiddenInTestResults"
  ],
  "rangeIncludes": [
    "https://www.rfc-editor.org/rfc/rfc9110#field.authorization.value"
  ]
}

Input as JSON
{
  "outbox": {
    "help": "the url to the Outbox handling an Activity POST request",
    "required": true,
    "type": "xsd:anyUri",
    "rangeIncludes": [
      "https://www.w3.org/ns/activitystreams#outbox"
    ]
  },
  "authorization": {
    "help": "HTTP Authorization header value to include in outbox POST request",
    "required": false,
    "type": [
      "xsd:string",
      "https://activitypub-testing.socialweb.coop/ns/HiddenInTestResults"
    ],
    "rangeIncludes": [
      "https://www.rfc-editor.org/rfc/rfc9110#field.authorization.value"
    ]
  }
}

Applicability ?

How to derive test targets from input:
* let outboxPostResponse be the http response from using an activitypub client to post to input.outbox
* if outboxPostResponse does not contain a 'location' header, result outcome is inapplicable.
* let resultLocation be the result of [Reference Resolution (rfc3986)](https://www.rfc-editor.org/rfc/rfc3986#section-5) with Base URI set to input.outbox and reference set to the value of the 'location' header in outboxPostResponse.
  * If the value of the location header is already an absolute url, resultLocation will be set to that value. If it's a relative url, it will be resolved relative to the outbox url.
* let target.newActivityId equal resultLocation
* let outboxGetResponse be the http response from using an activitypub client to fetch the ActivityPub object at input.outbox. If input.authorization is provided, it MUST be passed as the value of the http header named authorization.
* if outboxGetResponse http status is not in range [200, 299], return early. The outcome is 'inapplicable'. This test only applies when the test client can get a successful response to the get request.
* let target.outbox be the result of parsing outboxGetResponse body as JSON

Expectations ?

* let types be the result of
  * if target.outbox.type is an Array, return it
  * return an array containing only target.outbox.type
* let items be the result of
  * if types includes "OrderedCollection", return target.outbox.orderedItems
  * else return target.outbox.items
* at least one entry in items must have an id property equal to target.newActivityId

Assumptions ?

* we assume that the outbox post response location header includes the id of the newly submitted activity.
  * another requirement is outbox post servers ["MUST include the new id in the Location header"](https://activitypub-testing-website.socialweb.coop/00330762-59a2-4072-8d93-87ee4c30411c), so it seems like this is a reasonable assumption for servers that satisfy that requirement

Requirement Mapping

This Test has been derived from these specified requirements.

  • urn:uuid:58b55b12-550f-415d-9ce4-a5160c08676f

    content
    The server MUST then add this new Activity to the outbox collection.
    origin
    {
      "source": "https://www.w3.org/TR/activitypub/",
      "section": {
        "id": "https://www.w3.org/TR/activitypub/#x6-client-to-server-interactions",
        "branch": [
          6
        ]
      },
      "selector": {
        "type": "TextQuoteSelector",
        "exact": "The server MUST then add this new Activity to the outbox collection.\n",
        "prefix": "The server MUST remove the bto and/or bcc properties, if they exist, from the ActivityStreams object before delivery, but MUST utilize the addressing originally stored on the bto / bcc properties for determining recipients in delivery.\n",
        "suffix": "Depending on the type of Activity, servers may then be required to carry out further side effects. (However, there is no guarantee that time the Activity may appear in the outbox. The Activity might appear after a delay or disappear at any period). These are described per individual Activity below.\n"
      }
    }
    JSON
    {
      "id": "urn:uuid:58b55b12-550f-415d-9ce4-a5160c08676f",
      "uuid": "58b55b12-550f-415d-9ce4-a5160c08676f",
      "type": "Behavior",
      "content": "The server MUST then add this new Activity to the outbox collection.\n",
      "tag": [
        {
          "name": "ActivityPubServer",
          "id": "https://socialweb.coop/tag/ActivityPubServer"
        }
      ],
      "context": [
        "https://www.w3.org/TR/activitypub/",
        {
          "name": "Client to server interaction"
        },
        {
          "name": "clients posting Activities to an actor's outbox"
        }
      ],
      "origin": {
        "source": "https://www.w3.org/TR/activitypub/",
        "section": {
          "id": "https://www.w3.org/TR/activitypub/#x6-client-to-server-interactions",
          "branch": [
            6
          ]
        },
        "selector": {
          "type": "TextQuoteSelector",
          "exact": "The server MUST then add this new Activity to the outbox collection.\n",
          "prefix": "The server MUST remove the bto and/or bcc properties, if they exist, from the ActivityStreams object before delivery, but MUST utilize the addressing originally stored on the bto / bcc properties for determining recipients in delivery.\n",
          "suffix": "Depending on the type of Activity, servers may then be required to carry out further side effects. (However, there is no guarantee that time the Activity may appear in the outbox. The Activity might appear after a delay or disappear at any period). These are described per individual Activity below.\n"
        }
      },
      "@context": [
        "https://www.w3.org/ns/activitystreams",
        "https://socialweb.coop/ns/testing/context.json"
      ]
    }

JSON

Test Case as JSON
{
  "name": "Check that outbox post server added to outbox collection by getting the outbox collection and looking in the items",
  "input": {
    "outbox": {
      "help": "the url to the Outbox handling an Activity POST request",
      "required": true,
      "type": "xsd:anyUri",
      "rangeIncludes": [
        "https://www.w3.org/ns/activitystreams#outbox"
      ]
    },
    "authorization": {
      "help": "HTTP Authorization header value to include in outbox POST request",
      "required": false,
      "type": [
        "xsd:string",
        "https://activitypub-testing.socialweb.coop/ns/HiddenInTestResults"
      ],
      "rangeIncludes": [
        "https://www.rfc-editor.org/rfc/rfc9110#field.authorization.value"
      ]
    }
  },
  "description": "a test rule that sends a submission to an outbox then gets the outbox and expects to find the submitted activity",
  "applicability": "\nHow to derive test targets from input:\n* let outboxPostResponse be the http response from using an activitypub client to post to input.outbox\n* if outboxPostResponse does not contain a 'location' header, result outcome is inapplicable.\n* let resultLocation be the result of [Reference Resolution (rfc3986)](https://www.rfc-editor.org/rfc/rfc3986#section-5) with Base URI set to input.outbox and reference set to the value of the 'location' header in outboxPostResponse.\n  * If the value of the location header is already an absolute url, resultLocation will be set to that value. If it's a relative url, it will be resolved relative to the outbox url.\n* let target.newActivityId equal resultLocation\n* let outboxGetResponse be the http response from using an activitypub client to fetch the ActivityPub object at input.outbox. If input.authorization is provided, it MUST be passed as the value of the http header named authorization.\n* if outboxGetResponse http status is not in range [200, 299], return early. The outcome is 'inapplicable'. This test only applies when the test client can get a successful response to the get request.\n* let target.outbox be the result of parsing outboxGetResponse body as JSON\n",
  "assumptions": "\n* we assume that the outbox post response location header includes the id of the newly submitted activity.\n  * another requirement is outbox post servers [\"MUST include the new id in the Location header\"](https://activitypub-testing-website.socialweb.coop/00330762-59a2-4072-8d93-87ee4c30411c), so it seems like this is a reasonable assumption for servers that satisfy that requirement\n",
  "expectations": "\n* let types be the result of\n  * if target.outbox.type is an Array, return it\n  * return an array containing only target.outbox.type\n* let items be the result of\n  * if types includes \"OrderedCollection\", return target.outbox.orderedItems\n  * else return target.outbox.items\n* at least one entry in items must have an id property equal to target.newActivityId\n",
  "slug": "outbox-post-server-adds-to-outbox-collection-checked-by-outbox-get",
  "uuid": "43d3465d-6f5a-47c2-99ad-44bd883472b3",
  "requirementReference": [
    {
      "id": "urn:uuid:58b55b12-550f-415d-9ce4-a5160c08676f",
      "url": "https://activitypub-testing-website.socialweb.coop/58b55b12-550f-415d-9ce4-a5160c08676f"
    }
  ]
}