###
# Copyright (c) 2020-2021, The Limnoria Contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions, and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions, and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the author of this software nor the name of
# contributors to this software may be used to endorse or promote products
# derived from this software without specific prior written consent.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
###
import json
PRIVATE_KEY = b"""
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA6jtjTlaTh1aR+q3gpZvb4dj8s81zKmwy7cwn44LtLV+ivNf/
SkWPr1zkm/gWFItC3058Faqk9p4fdJaxVJJTW0KL7LlJs+LTcMsLi2nTgvBZg7oE
KRXZxuJJcc5QNkgY8vHt1PxdD17mZBGwfg2loZfnjZOOz4F8wdQ18Da1ZFUFyc+R
qj1THdXbpBj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MYoeRG4zetHsLDHRp
py6ITWcTdF3MC9+C3Lz65yYGr4ryRaDblhIyx86JINB5piq/4nbOaST93sI48Dwu
6AhMKxiZ7peUSNrdlbkeCqtrpPr4SJzcSVmyQaCDAHToRZCiEI8qSiOdXDae6wtW
7YM14QKBgQDnbseQK0yzrsZoOmQ9PBULr4vNLiL5+OllOG1+GNNztk/Q+Xfx6Hvw
h6cgTcpZsvaa2CW6A2yqenmGfKBgiRoN39vFqjVDkjL1HaL3rPeK1H7RWrz1Sto7
rut+UhYHat9fo6950Wvxa4Iee9q0NOF0HUkD6WupcPyC0nSEex8Z6A==
-----END RSA PRIVATE KEY-----
"""
HOSTMETA_URL = "https://example.org/.well-known/host-meta"
HOSTMETA_DATA = b"""
My Biography
", "url": "https://example.org/@someuser", "manuallyApprovesFollowers": False, "discoverable": True, "publicKey": { "id": "https://example.org/users/someuser#main-key", "owner": "https://example.org/users/someuser", "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkaY84E/OjpjF7Dgy/nC+\nySBCiQvSOKBpNl468XP1QiOiMsILC1ec2J+LpU1Tm0kAC+uY8budLx6Wt+oz+4FU\n/82S9j9jVkWPiNVHJSQHXi13F9YQ4+MwC8niKc+qsmKUL8crSbd7dmCnOBxhvJWf\nfwOk1TW4u1fxXqHMFuw5zdfDlmRlU2FLX1LYTOxLnGp/ef/BAykV3rz6VouhAQwO\nhRay7ZgI5zlT7NtCoA17I8YiYfEs7MH0nBMrKOMw5eR1WDf5Gw78C/IAZHP1WVMv\n63V3N71OrMSfCH20OZ1H2Gyov5GX4+NSx7HI26dMDldQWOb2rYS9d0/7qM2xNUK8\n3wIDAQAB\n-----END PUBLIC KEY-----\n", }, "attachment": [ {"type": "PropertyValue", "name": "Pronoun", "value": "they"}, {"type": "PropertyValue", "name": "Location", "value": "Somewhere"}, ], "endpoints": {"sharedInbox": "https://example.org/inbox"}, "icon": { "type": "Image", "mediaType": "image/png", "url": "https://assets.example.org/avatar.png", }, "image": { "type": "Image", "mediaType": "image/png", "url": "https://assets.example.org/header.png", }, } ACTOR_DATA = json.dumps(ACTOR_VALUE).encode() OUTBOX_URL = "https://example.org/users/someuser/outbox" OUTBOX_VALUE = { "@context": "https://www.w3.org/ns/activitystreams", "id": "https://example.org/users/someuser/outbox", "type": "OrderedCollection", "totalItems": 4835, "first": "https://example.org/users/someuser/outbox?page=true", "last": "https://example.org/users/someuser/outbox?min_id=0&page=true", } OUTBOX_DATA = json.dumps(OUTBOX_VALUE).encode() STATUS_URL = "https://example.org/users/someuser/statuses/1234" STATUS_VALUE = { "id": "https://example.org/users/someuser/statuses/1234/activity", "type": "Create", "actor": "https://example.org/users/someuser", "published": "2020-05-08T01:23:45Z", "to": ["https://example.org/users/someuser/followers"], "cc": [ "https://www.w3.org/ns/activitystreams#Public", "https://example.com/users/FirstAuthor", ], "object": { "id": "https://example.org/users/someuser/statuses/1234", "type": "Note", "summary": None, "inReplyTo": "https://example.com/users/FirstAuthor/statuses/42", "published": "2020-05-08T01:23:45Z", "url": "https://example.org/@FirstAuthor/42", "attributedTo": "https://example.org/users/someuser", "to": ["https://example.org/users/someuser/followers"], "cc": [ "https://www.w3.org/ns/activitystreams#Public", "https://example.com/users/FirstAuthor", ], "sensitive": False, "atomUri": "https://example.org/users/someuser/statuses/1234", "inReplyToAtomUri": "https://example.com/users/FirstAuthor/statuses/42", "conversation": "tag:example.com,2020-05-08:objectId=aaaa:objectType=Conversation", "content": '@FirstAuthor I am replying to you
', "contentMap": { "en": '@FirstAuthor I am replying to you
' }, "attachment": [], "tag": [ { "type": "Mention", "href": "https://example.com/users/FirstAuthor", "name": "@FirstAuthor@example.com", } ], "replies": { "id": "https://example.org/users/someuser/statuses/1234/replies", "type": "Collection", "first": { "type": "CollectionPage", "next": "https://example.org/users/someuser/statuses/1234/replies?only_other_accounts=true&page=true", "partOf": "https://example.org/users/someuser/statuses/1234/replies", "items": [], }, }, }, } STATUS_DATA = json.dumps(STATUS_VALUE).encode() STATUS_WITH_PHOTO_URL = "https://example.org/users/someuser/statuses/123" STATUS_WITH_PHOTO_VALUE = { "@context": [ "https://www.w3.org/ns/activitystreams", "https://example.org/schemas/litepub-0.1.jsonld", ], "actor": "https://example.org/users/someuser", "attachment": [ { "mediaType": "image/jpeg", "name": "IMG_foo.jpg", "type": "Document", "url": "https://example.org/foo.jpg", } ], "attributedTo": "https://example.org/users/someuser", "cc": ["https://www.w3.org/ns/activitystreams#Public"], "content": "Here is a picture", "id": "https://example.org/users/someuser/statuses/123", "published": "2020-05-08T01:23:45Z", "sensitive": False, "summary": "", "tag": [], "to": ["https://example.org/users/someuser/followers"], "type": "Note", } STATUS_WITH_PHOTO_DATA = json.dumps(STATUS_WITH_PHOTO_VALUE).encode() OUTBOX_FIRSTPAGE_URL = "https://example.org/users/someuser/outbox?page=true" OUTBOX_FIRSTPAGE_VALUE = { "@context": [ "https://www.w3.org/ns/activitystreams", { "ostatus": "http://ostatus.org#", "atomUri": "ostatus:atomUri", "inReplyToAtomUri": "ostatus:inReplyToAtomUri", "conversation": "ostatus:conversation", "sensitive": "as:sensitive", "toot": "http://joinmastodon.org/ns#", "votersCount": "toot:votersCount", "Emoji": "toot:Emoji", "focalPoint": {"@container": "@list", "@id": "toot:focalPoint"}, }, ], "id": "https://example.org/users/someuser/outbox?page=true", "type": "OrderedCollectionPage", "next": "https://example.org/users/someuser/outbox?max_id=104101144953797529&page=true", "prev": "https://example.org/users/someuser/outbox?min_id=104135036335976677&page=true", "partOf": "https://example.org/users/someuser/outbox", "orderedItems": [ STATUS_VALUE, { "id": "https://example.org/users/someuser/statuses/1235/activity", "type": "Create", "actor": "https://example.org/users/someuser", "published": "2020-05-08T01:23:45Z", "to": ["https://example.org/users/someuser/followers"], "cc": ["https://www.w3.org/ns/activitystreams#Public"], "object": { "id": "https://example.org/users/someuser/statuses/1235", "type": "Note", "summary": "This is a content warning", "attributedTo": "https://example.org/users/someuser", "inReplyTo": None, "content": "This is a status with a content warning
", }, }, { "id": "https://example.org/users/someuser/statuses/12345/activity", "type": "Announce", "actor": "https://example.org/users/someuser", "published": "2020-05-05T11:22:33Z", "to": ["https://example.org/users/someuser/followers"], "cc": [ "https://example.net/users/BoostedUser", "https://www.w3.org/ns/activitystreams#Public", ], "object": "https://example.net/users/BoostedUser/statuses/123456", "atomUri": "https://example.org/users/someuser/statuses/12345/activity", }, ], } OUTBOX_FIRSTPAGE_DATA = json.dumps(OUTBOX_FIRSTPAGE_VALUE).encode() BOOSTED_URL = "https://example.net/users/BoostedUser/statuses/123456" BOOSTED_VALUE = { "@context": [ "https://www.w3.org/ns/activitystreams", { "ostatus": "http://ostatus.org#", "atomUri": "ostatus:atomUri", "inReplyToAtomUri": "ostatus:inReplyToAtomUri", "conversation": "ostatus:conversation", "sensitive": "as:sensitive", "toot": "http://joinmastodon.org/ns#", "votersCount": "toot:votersCount", "blurhash": "toot:blurhash", "focalPoint": {"@container": "@list", "@id": "toot:focalPoint"}, }, ], "id": "https://example.net/users/BoostedUser/statuses/123456", "type": "Note", "summary": None, "inReplyTo": None, "published": "2020-05-05T11:00:00Z", "url": "https://example.net/@BoostedUser/123456", "attributedTo": "https://example.net/users/BoostedUser", "to": ["https://www.w3.org/ns/activitystreams#Public"], "cc": ["https://example.net/users/BoostedUser/followers"], "sensitive": False, "atomUri": "https://example.net/users/BoostedUser/statuses/123456", "inReplyToAtomUri": None, "conversation": "tag:example.net,2020-05-05:objectId=bbbbb:objectType=Conversation", "content": "Status Content
", "contentMap": {"en": "Status Content
"}, "attachment": [ { "type": "Document", "mediaType": "image/png", "url": "https://example.net/system/media_attachments/image.png", "name": "Alt Text", "focalPoint": [0.0, 0.0], } ], "tag": [], "replies": { "id": "https://example.net/users/BoostedUser/statuses/123456/replies", "type": "Collection", "first": { "type": "CollectionPage", "next": "https://example.net/users/BoostedUser/statuses/123456/replies?only_other_accounts=true&page=true", "partOf": "https://example.net/users/BoostedUser/statuses/123456/replies", "items": [], }, }, } BOOSTED_DATA = json.dumps(BOOSTED_VALUE).encode() BOOSTED_ACTOR_URL = "https://example.net/users/BoostedUser" BOOSTED_ACTOR_VALUE = { "@context": [ "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1", { "manuallyApprovesFollowers": "as:manuallyApprovesFollowers", "toot": "http://joinmastodon.org/ns#", "featured": {"@id": "toot:featured", "@type": "@id"}, "alsoKnownAs": {"@id": "as:alsoKnownAs", "@type": "@id"}, "movedTo": {"@id": "as:movedTo", "@type": "@id"}, "schema": "http://schema.org#", "PropertyValue": "schema:PropertyValue", "value": "schema:value", "IdentityProof": "toot:IdentityProof", "discoverable": "toot:discoverable", "focalPoint": {"@container": "@list", "@id": "toot:focalPoint"}, }, ], "id": "https://example.net/users/BoostedUser", "type": "Person", "following": "https://example.net/users/BoostedUser/following", "followers": "https://example.net/users/BoostedUser/followers", "inbox": "https://example.net/users/BoostedUser/inbox", "outbox": "https://example.net/users/BoostedUser/outbox", "featured": "https://example.net/users/BoostedUser/collections/featured", "preferredUsername": "BoostedUser", "name": "Boosted User", "url": "https://example.net/@BoostedUser", "endpoints": {"sharedInbox": "https://example.net/inbox"}, } BOOSTED_ACTOR_DATA = json.dumps(BOOSTED_ACTOR_VALUE).encode()