gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

converter_test.go (21806B)


      1 // GoToSocial
      2 // Copyright (C) GoToSocial Authors admin@gotosocial.org
      3 // SPDX-License-Identifier: AGPL-3.0-or-later
      4 //
      5 // This program is free software: you can redistribute it and/or modify
      6 // it under the terms of the GNU Affero General Public License as published by
      7 // the Free Software Foundation, either version 3 of the License, or
      8 // (at your option) any later version.
      9 //
     10 // This program is distributed in the hope that it will be useful,
     11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 // GNU Affero General Public License for more details.
     14 //
     15 // You should have received a copy of the GNU Affero General Public License
     16 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
     17 
     18 package typeutils_test
     19 
     20 import (
     21 	"github.com/stretchr/testify/suite"
     22 	"github.com/superseriousbusiness/activity/streams/vocab"
     23 	"github.com/superseriousbusiness/gotosocial/internal/db"
     24 	"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
     25 	"github.com/superseriousbusiness/gotosocial/internal/processing"
     26 	"github.com/superseriousbusiness/gotosocial/internal/state"
     27 	"github.com/superseriousbusiness/gotosocial/internal/typeutils"
     28 	"github.com/superseriousbusiness/gotosocial/internal/visibility"
     29 	"github.com/superseriousbusiness/gotosocial/testrig"
     30 )
     31 
     32 const (
     33 	statusWithMentionsActivityJson = `{
     34 		"@context": [
     35 		  "https://www.w3.org/ns/activitystreams",
     36 		  {
     37 			"ostatus": "http://ostatus.org#",
     38 			"atomUri": "ostatus:atomUri",
     39 			"inReplyToAtomUri": "ostatus:inReplyToAtomUri",
     40 			"conversation": "ostatus:conversation",
     41 			"sensitive": "as:sensitive",
     42 			"toot": "http://joinmastodon.org/ns#",
     43 			"votersCount": "toot:votersCount"
     44 		  }
     45 		],
     46 		"id": "http://fossbros-anonymous.io/users/foss_satan/statuses/106221634728637552/activity",
     47 		"type": "Create",
     48 		"actor": "http://fossbros-anonymous.io/users/foss_satan",
     49 		"published": "2021-05-12T09:58:38.00Z",
     50 		"to": [
     51 		  "http://fossbros-anonymous.io/users/foss_satan/followers"
     52 		],
     53 		"cc": [
     54 		  "https://www.w3.org/ns/activitystreams#Public",
     55 		  "http://localhost:8080/users/the_mighty_zork"
     56 		],
     57 		"object": {
     58 		  "id": "http://fossbros-anonymous.io/users/foss_satan/statuses/106221634728637552",
     59 		  "type": "Note",
     60 		  "summary": null,
     61 		  "inReplyTo": "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY",
     62 		  "published": "2021-05-12T09:58:38.00Z",
     63 		  "url": "https://ondergrond.org/@dumpsterqueer/106221634728637552",
     64 		  "attributedTo": "http://fossbros-anonymous.io/users/foss_satan",
     65 		  "to": [
     66 			"http://fossbros-anonymous.io/users/foss_satan/followers"
     67 		  ],
     68 		  "cc": [
     69 			"https://www.w3.org/ns/activitystreams#Public",
     70 			"http://localhost:8080/users/the_mighty_zork"
     71 		  ],
     72 		  "sensitive": false,
     73 		  "conversation": "tag:ondergrond.org,2021-05-12:objectId=1132361:objectType=Conversation",
     74 		  "content": "<p><span class=\"h-card\"><a href=\"http://localhost:8080/@the_mighty_zork\" class=\"u-url mention\">@<span>the_mighty_zork</span></a></span> nice there it is:</p><p><a href=\"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/activity\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"ellipsis\">social.pixie.town/users/f0x/st</span><span class=\"invisible\">atuses/106221628567855262/activity</span></a></p>",
     75 		  "contentMap": {
     76 			"en": "<p><span class=\"h-card\"><a href=\"http://localhost:8080/@the_mighty_zork\" class=\"u-url mention\">@<span>the_mighty_zork</span></a></span> nice there it is:</p><p><a href=\"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/activity\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"ellipsis\">social.pixie.town/users/f0x/st</span><span class=\"invisible\">atuses/106221628567855262/activity</span></a></p>"
     77 		  },
     78 		  "attachment": [],
     79 		  "tag": [
     80 			{
     81 			  "type": "Mention",
     82 			  "href": "http://localhost:8080/users/the_mighty_zork",
     83 			  "name": "@the_mighty_zork@localhost:8080"
     84 			}
     85 		  ],
     86 		  "replies": {
     87 			"id": "http://fossbros-anonymous.io/users/foss_satan/statuses/106221634728637552/replies",
     88 			"type": "Collection",
     89 			"first": {
     90 			  "type": "CollectionPage",
     91 			  "next": "http://fossbros-anonymous.io/users/foss_satan/statuses/106221634728637552/replies?only_other_accounts=true&page=true",
     92 			  "partOf": "http://fossbros-anonymous.io/users/foss_satan/statuses/106221634728637552/replies",
     93 			  "items": []
     94 			}
     95 		  }
     96 		}
     97 	  }`
     98 	statusWithEmojisAndTagsAsActivityJson = `{
     99 		"@context": [
    100 		  "https://www.w3.org/ns/activitystreams",
    101 		  {
    102 			"ostatus": "http://ostatus.org#",
    103 			"atomUri": "ostatus:atomUri",
    104 			"inReplyToAtomUri": "ostatus:inReplyToAtomUri",
    105 			"conversation": "ostatus:conversation",
    106 			"sensitive": "as:sensitive",
    107 			"toot": "http://joinmastodon.org/ns#",
    108 			"votersCount": "toot:votersCount",
    109 			"Hashtag": "as:Hashtag",
    110 			"Emoji": "toot:Emoji",
    111 			"focalPoint": {
    112 			  "@container": "@list",
    113 			  "@id": "toot:focalPoint"
    114 			}
    115 		  }
    116 		],
    117 		"id": "http://fossbros-anonymous.io/users/foss_satan/statuses/106221567884565704/activity",
    118 		"type": "Create",
    119 		"actor": "http://fossbros-anonymous.io/users/foss_satan",
    120 		"published": "2021-05-12T09:41:38.00Z",
    121 		"to": [
    122 		  "http://fossbros-anonymous.io/users/foss_satan/followers"
    123 		],
    124 		"cc": [
    125 		  "https://www.w3.org/ns/activitystreams#Public"
    126 		],
    127 		"object": {
    128 		  "id": "http://fossbros-anonymous.io/users/foss_satan/statuses/106221567884565704",
    129 		  "type": "Note",
    130 		  "summary": null,
    131 		  "inReplyTo": null,
    132 		  "published": "2021-05-12T09:41:38.00Z",
    133 		  "url": "https://ondergrond.org/@dumpsterqueer/106221567884565704",
    134 		  "attributedTo": "http://fossbros-anonymous.io/users/foss_satan",
    135 		  "to": [
    136 			"http://fossbros-anonymous.io/users/foss_satan/followers"
    137 		  ],
    138 		  "cc": [
    139 			"https://www.w3.org/ns/activitystreams#Public"
    140 		  ],
    141 		  "sensitive": false,
    142 		  "atomUri": "http://fossbros-anonymous.io/users/foss_satan/statuses/106221567884565704",
    143 		  "inReplyToAtomUri": null,
    144 		  "conversation": "tag:ondergrond.org,2021-05-12:objectId=1132361:objectType=Conversation",
    145 		  "content": "<p>just testing activitypub representations of <a href=\"https://ondergrond.org/tags/tags\" class=\"mention hashtag\" rel=\"tag\">#<span>tags</span></a> and <a href=\"https://ondergrond.org/tags/emoji\" class=\"mention hashtag\" rel=\"tag\">#<span>emoji</span></a>  :party_parrot: :amaze: :blobsunglasses: </p><p>don&apos;t mind me....</p>",
    146 		  "contentMap": {
    147 			"en": "<p>just testing activitypub representations of <a href=\"https://ondergrond.org/tags/tags\" class=\"mention hashtag\" rel=\"tag\">#<span>tags</span></a> and <a href=\"https://ondergrond.org/tags/emoji\" class=\"mention hashtag\" rel=\"tag\">#<span>emoji</span></a>  :party_parrot: :amaze: :blobsunglasses: </p><p>don&apos;t mind me....</p>"
    148 		  },
    149 		  "attachment": [],
    150 		  "tag": [
    151 			{
    152 			  "type": "Hashtag",
    153 			  "href": "https://ondergrond.org/tags/tags",
    154 			  "name": "#tags"
    155 			},
    156 			{
    157 			  "type": "Hashtag",
    158 			  "href": "https://ondergrond.org/tags/emoji",
    159 			  "name": "#emoji"
    160 			},
    161 			{
    162 			  "id": "https://ondergrond.org/emojis/2390",
    163 			  "type": "Emoji",
    164 			  "name": ":party_parrot:",
    165 			  "updated": "2020-11-06T13:42:11.00Z",
    166 			  "icon": {
    167 				"type": "Image",
    168 				"mediaType": "image/gif",
    169 				"url": "https://ondergrond.org/system/custom_emojis/images/000/002/390/original/ef133aac7ab23341.gif"
    170 			  }
    171 			},
    172 			{
    173 			  "id": "https://ondergrond.org/emojis/2395",
    174 			  "type": "Emoji",
    175 			  "name": ":amaze:",
    176 			  "updated": "2020-09-26T12:29:56.00Z",
    177 			  "icon": {
    178 				"type": "Image",
    179 				"mediaType": "image/png",
    180 				"url": "https://ondergrond.org/system/custom_emojis/images/000/002/395/original/2c7d9345e57367ed.png"
    181 			  }
    182 			},
    183 			{
    184 			  "id": "https://ondergrond.org/emojis/764",
    185 			  "type": "Emoji",
    186 			  "name": ":blobsunglasses:",
    187 			  "updated": "2020-09-26T12:13:23.00Z",
    188 			  "icon": {
    189 				"type": "Image",
    190 				"mediaType": "image/png",
    191 				"url": "https://ondergrond.org/system/custom_emojis/images/000/000/764/original/3f8eef9de773c90d.png"
    192 			  }
    193 			}
    194 		  ],
    195 		  "replies": {
    196 			"id": "http://fossbros-anonymous.io/users/foss_satan/statuses/106221567884565704/replies",
    197 			"type": "Collection",
    198 			"first": {
    199 			  "type": "CollectionPage",
    200 			  "next": "http://fossbros-anonymous.io/users/foss_satan/statuses/106221567884565704/replies?only_other_accounts=true&page=true",
    201 			  "partOf": "http://fossbros-anonymous.io/users/foss_satan/statuses/106221567884565704/replies",
    202 			  "items": []
    203 			}
    204 		  }
    205 		}
    206 	  }`
    207 	gargronAsActivityJson = `{
    208 		"@context": [
    209 		  "https://www.w3.org/ns/activitystreams",
    210 		  "https://w3id.org/security/v1",
    211 		  {
    212 			"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
    213 			"toot": "http://joinmastodon.org/ns#",
    214 			"featured": {
    215 			  "@id": "toot:featured",
    216 			  "@type": "@id"
    217 			},
    218 			"featuredTags": {
    219 			  "@id": "toot:featuredTags",
    220 			  "@type": "@id"
    221 			},
    222 			"alsoKnownAs": {
    223 			  "@id": "as:alsoKnownAs",
    224 			  "@type": "@id"
    225 			},
    226 			"movedTo": {
    227 			  "@id": "as:movedTo",
    228 			  "@type": "@id"
    229 			},
    230 			"schema": "http://schema.org#",
    231 			"PropertyValue": "schema:PropertyValue",
    232 			"value": "schema:value",
    233 			"IdentityProof": "toot:IdentityProof",
    234 			"discoverable": "toot:discoverable",
    235 			"Device": "toot:Device",
    236 			"Ed25519Signature": "toot:Ed25519Signature",
    237 			"Ed25519Key": "toot:Ed25519Key",
    238 			"Curve25519Key": "toot:Curve25519Key",
    239 			"EncryptedMessage": "toot:EncryptedMessage",
    240 			"publicKeyBase64": "toot:publicKeyBase64",
    241 			"deviceId": "toot:deviceId",
    242 			"claim": {
    243 			  "@type": "@id",
    244 			  "@id": "toot:claim"
    245 			},
    246 			"fingerprintKey": {
    247 			  "@type": "@id",
    248 			  "@id": "toot:fingerprintKey"
    249 			},
    250 			"identityKey": {
    251 			  "@type": "@id",
    252 			  "@id": "toot:identityKey"
    253 			},
    254 			"devices": {
    255 			  "@type": "@id",
    256 			  "@id": "toot:devices"
    257 			},
    258 			"messageFranking": "toot:messageFranking",
    259 			"messageType": "toot:messageType",
    260 			"cipherText": "toot:cipherText",
    261 			"suspended": "toot:suspended",
    262 			"focalPoint": {
    263 			  "@container": "@list",
    264 			  "@id": "toot:focalPoint"
    265 			}
    266 		  }
    267 		],
    268 		"id": "https://mastodon.social/users/Gargron",
    269 		"type": "Person",
    270 		"following": "https://mastodon.social/users/Gargron/following",
    271 		"followers": "https://mastodon.social/users/Gargron/followers",
    272 		"inbox": "https://mastodon.social/users/Gargron/inbox",
    273 		"outbox": "https://mastodon.social/users/Gargron/outbox",
    274 		"featured": "https://mastodon.social/users/Gargron/collections/featured",
    275 		"featuredTags": "https://mastodon.social/users/Gargron/collections/tags",
    276 		"preferredUsername": "Gargron",
    277 		"name": "Eugen",
    278 		"summary": "<p>Developer of Mastodon and administrator of mastodon.social. I post service announcements, development updates, and personal stuff.</p>",
    279 		"url": "https://mastodon.social/@Gargron",
    280 		"manuallyApprovesFollowers": false,
    281 		"discoverable": true,
    282 		"devices": "https://mastodon.social/users/Gargron/collections/devices",
    283 		"alsoKnownAs": [
    284 		  "https://tooting.ai/users/Gargron"
    285 		],
    286 		"publicKey": {
    287 		  "id": "https://mastodon.social/users/Gargron#main-key",
    288 		  "owner": "https://mastodon.social/users/Gargron",
    289 		  "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvXc4vkECU2/CeuSo1wtn\nFoim94Ne1jBMYxTZ9wm2YTdJq1oiZKif06I2fOqDzY/4q/S9uccrE9Bkajv1dnkO\nVm31QjWlhVpSKynVxEWjVBO5Ienue8gND0xvHIuXf87o61poqjEoepvsQFElA5ym\novljWGSA/jpj7ozygUZhCXtaS2W5AD5tnBQUpcO0lhItYPYTjnmzcc4y2NbJV8hz\n2s2G8qKv8fyimE23gY1XrPJg+cRF+g4PqFXujjlJ7MihD9oqtLGxbu7o1cifTn3x\nBfIdPythWu5b4cujNsB3m3awJjVmx+MHQ9SugkSIYXV0Ina77cTNS0M2PYiH1PFR\nTwIDAQAB\n-----END PUBLIC KEY-----\n"
    290 		},
    291 		"tag": [],
    292 		"attachment": [
    293 		  {
    294 			"type": "PropertyValue",
    295 			"name": "Patreon",
    296 			"value": "<a href=\"https://www.patreon.com/mastodon\" rel=\"me nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://www.</span><span class=\"\">patreon.com/mastodon</span><span class=\"invisible\"></span></a>"
    297 		  },
    298 		  {
    299 			"type": "PropertyValue",
    300 			"name": "Homepage",
    301 			"value": "<a href=\"https://zeonfederated.com\" rel=\"me nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">zeonfederated.com</span><span class=\"invisible\"></span></a>"
    302 		  },
    303 		  {
    304 			"type": "IdentityProof",
    305 			"name": "gargron",
    306 			"signatureAlgorithm": "keybase",
    307 			"signatureValue": "5cfc20c7018f2beefb42a68836da59a792e55daa4d118498c9b1898de7e845690f"
    308 		  }
    309 		],
    310 		"endpoints": {
    311 		  "sharedInbox": "https://mastodon.social/inbox"
    312 		},
    313 		"icon": {
    314 		  "type": "Image",
    315 		  "mediaType": "image/jpeg",
    316 		  "url": "https://files.mastodon.social/accounts/avatars/000/000/001/original/d96d39a0abb45b92.jpg"
    317 		},
    318 		"image": {
    319 		  "type": "Image",
    320 		  "mediaType": "image/png",
    321 		  "url": "https://files.mastodon.social/accounts/headers/000/000/001/original/c91b871f294ea63e.png"
    322 		}
    323 	  }`
    324 	publicStatusActivityJson = `
    325 	{
    326 		"@context": [
    327 		  "https://www.w3.org/ns/activitystreams",
    328 		  {
    329 			"ostatus": "http://ostatus.org#",
    330 			"atomUri": "ostatus:atomUri",
    331 			"inReplyToAtomUri": "ostatus:inReplyToAtomUri",
    332 			"conversation": "ostatus:conversation",
    333 			"sensitive": "as:sensitive",
    334 			"toot": "http://joinmastodon.org/ns#",
    335 			"votersCount": "toot:votersCount"
    336 		  }
    337 		],
    338 		"id": "http://fossbros-anonymous.io/users/foss_satan/statuses/108138763199405167",
    339 		"type": "Note",
    340 		"summary": "reading: Punishment and Reward in the Corporate University",
    341 		"inReplyTo": "http://fossbros-anonymous.io/users/foss_satan/statuses/108138729399508469",
    342 		"published": "2022-04-15T23:49:37.00Z",
    343 		"url": "http://fossbros-anonymous.io/@foss_satan/108138763199405167",
    344 		"attributedTo": "http://fossbros-anonymous.io/users/foss_satan",
    345 		"to": [
    346 		  "https://www.w3.org/ns/activitystreams#Public"
    347 		],
    348 		"cc": [
    349 		  "http://fossbros-anonymous.io/users/foss_satan/followers"
    350 		],
    351 		"sensitive": true,
    352 		"atomUri": "http://fossbros-anonymous.io/users/foss_satan/statuses/108138763199405167",
    353 		"inReplyToAtomUri": "http://fossbros-anonymous.io/users/foss_satan/statuses/108138729399508469",
    354 		"content": "<p>&gt; So we have to examine critical thinking as a signifier, dynamic and ambiguous.  It has a normative definition, a tacit definition, and an ideal definition.  One of the hallmarks of graduate training is learning to comprehend those definitions and applying the correct one as needed for professional success.</p>",
    355 		"contentMap": {
    356 		  "en": "<p>&gt; So we have to examine critical thinking as a signifier, dynamic and ambiguous.  It has a normative definition, a tacit definition, and an ideal definition.  One of the hallmarks of graduate training is learning to comprehend those definitions and applying the correct one as needed for professional success.</p>"
    357 		},
    358 		"attachment": [],
    359 		"tag": [],
    360 		"replies": {
    361 		  "id": "http://fossbros-anonymous.io/users/foss_satan/statuses/108138763199405167/replies",
    362 		  "type": "Collection",
    363 		  "first": {
    364 			"type": "CollectionPage",
    365 			"next": "http://fossbros-anonymous.io/users/foss_satan/statuses/108138763199405167/replies?only_other_accounts=true&page=true",
    366 			"partOf": "http://fossbros-anonymous.io/users/foss_satan/statuses/108138763199405167/replies",
    367 			"items": []
    368 		  }
    369 		}
    370 	  }	  
    371 	`
    372 	publicStatusActivityJsonNoURL = `
    373 	{
    374 		"@context": [
    375 		  "https://www.w3.org/ns/activitystreams",
    376 		  {
    377 			"ostatus": "http://ostatus.org#",
    378 			"atomUri": "ostatus:atomUri",
    379 			"inReplyToAtomUri": "ostatus:inReplyToAtomUri",
    380 			"conversation": "ostatus:conversation",
    381 			"sensitive": "as:sensitive",
    382 			"toot": "http://joinmastodon.org/ns#",
    383 			"votersCount": "toot:votersCount"
    384 		  }
    385 		],
    386 		"id": "http://fossbros-anonymous.io/users/foss_satan/statuses/108138763199405167",
    387 		"type": "Note",
    388 		"summary": "reading: Punishment and Reward in the Corporate University",
    389 		"inReplyTo": "http://fossbros-anonymous.io/users/foss_satan/statuses/108138729399508469",
    390 		"published": "2022-04-15T23:49:37.00Z",
    391 		"attributedTo": "http://fossbros-anonymous.io/users/foss_satan",
    392 		"to": [
    393 		  "https://www.w3.org/ns/activitystreams#Public"
    394 		],
    395 		"cc": [
    396 		  "http://fossbros-anonymous.io/users/foss_satan/followers"
    397 		],
    398 		"sensitive": true,
    399 		"atomUri": "http://fossbros-anonymous.io/users/foss_satan/statuses/108138763199405167",
    400 		"inReplyToAtomUri": "http://fossbros-anonymous.io/users/foss_satan/statuses/108138729399508469",
    401 		"content": "<p>&gt; So we have to examine critical thinking as a signifier, dynamic and ambiguous.  It has a normative definition, a tacit definition, and an ideal definition.  One of the hallmarks of graduate training is learning to comprehend those definitions and applying the correct one as needed for professional success.</p>",
    402 		"contentMap": {
    403 		  "en": "<p>&gt; So we have to examine critical thinking as a signifier, dynamic and ambiguous.  It has a normative definition, a tacit definition, and an ideal definition.  One of the hallmarks of graduate training is learning to comprehend those definitions and applying the correct one as needed for professional success.</p>"
    404 		},
    405 		"attachment": [],
    406 		"tag": [],
    407 		"replies": {
    408 		  "id": "http://fossbros-anonymous.io/users/foss_satan/statuses/108138763199405167/replies",
    409 		  "type": "Collection",
    410 		  "first": {
    411 			"type": "CollectionPage",
    412 			"next": "http://fossbros-anonymous.io/users/foss_satan/statuses/108138763199405167/replies?only_other_accounts=true&page=true",
    413 			"partOf": "http://fossbros-anonymous.io/users/foss_satan/statuses/108138763199405167/replies",
    414 			"items": []
    415 		  }
    416 		}
    417 	  }	  
    418 	`
    419 	owncastService = `
    420 	{
    421 		"@context": [
    422 		  "https://www.w3.org/ns/activitystreams",
    423 		  "http://joinmastodon.org/ns",
    424 		  "https://w3id.org/security/v1"
    425 		],
    426 		"attachment": {
    427 		  "name": "Stream",
    428 		  "type": "PropertyValue",
    429 		  "value": "<a href=\"https://owncast.example.org\" rel=\"me nofollow noopener noreferrer\" target=\"_blank\">https://owncast.example.org</a>"
    430 		},
    431 		"discoverable": true,
    432 		"followers": "https://owncast.example.org/federation/user/rgh/followers",
    433 		"icon": {
    434 		  "type": "Image",
    435 		  "url": "https://owncast.example.org/logo/external"
    436 		},
    437 		"id": "https://owncast.example.org/federation/user/rgh",
    438 		"image": {
    439 		  "type": "Image",
    440 		  "url": "https://owncast.example.org/logo/external"
    441 		},
    442 		"inbox": "https://owncast.example.org/federation/user/rgh/inbox",
    443 		"manuallyApprovesFollowers": false,
    444 		"name": "Rob's Owncast Server",
    445 		"outbox": "https://owncast.example.org/federation/user/rgh/outbox",
    446 		"preferredUsername": "rgh",
    447 		"publicKey": {
    448 		  "id": "https://owncast.example.org/federation/user/rgh#main-key",
    449 		  "owner": "https://owncast.example.org/federation/user/rgh",
    450 		  "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAurN+lUNwcGV2poLNtaoT\naRtJzN6s4SDcBmIFk82lxhdMKC6/Nssm+hvDuxWGqL0+dHwSvrG11rA6irGuSzRk\niHjYyVwYe/p1CxqJxzUfZVJAWdsCFWy+HtDrTWs5sggj1MiL59uGxvkCep+OYBuG\nBI8CvSOMLrDp8soCg3EY+zSgpXtGMuRaaUukavsfuglApShB61ny7W8LG252iKC5\nmyO8L7l8TNa5BrIi/pRHLzvv9aWiCa8VKtvmqj+mClEhpkRhImSk5GPJXgouTTgl\ntT28NYYciSf9YYgZ0SNWHdLUCdkMF592j4+BbkPvdgzc70G4yyu2GcWnTzBuvF5X\nYwIDAQAB\n-----END PUBLIC KEY-----\n"
    451 		},
    452 		"published": "2022-05-22T18:44:57.00Z",
    453 		"summary": "linux audio stuff ",
    454 		"tag": [
    455 		  {
    456 			"href": "https://directory.owncast.online/tags/owncast",
    457 			"name": "#owncast",
    458 			"type": "Hashtag"
    459 		  },
    460 		  {
    461 			"href": "https://directory.owncast.online/tags/streaming",
    462 			"name": "#streaming",
    463 			"type": "Hashtag"
    464 		  }
    465 		],
    466 		"type": "Service",
    467 		"url": "https://owncast.example.org/federation/user/rgh"
    468 	} 
    469 `
    470 )
    471 
    472 type TypeUtilsTestSuite struct {
    473 	suite.Suite
    474 	db              db.DB
    475 	state           state.State
    476 	testAccounts    map[string]*gtsmodel.Account
    477 	testStatuses    map[string]*gtsmodel.Status
    478 	testAttachments map[string]*gtsmodel.MediaAttachment
    479 	testPeople      map[string]vocab.ActivityStreamsPerson
    480 	testEmojis      map[string]*gtsmodel.Emoji
    481 	testReports     map[string]*gtsmodel.Report
    482 	testMentions    map[string]*gtsmodel.Mention
    483 
    484 	typeconverter typeutils.TypeConverter
    485 }
    486 
    487 func (suite *TypeUtilsTestSuite) SetupTest() {
    488 	suite.state.Caches.Init()
    489 
    490 	testrig.InitTestConfig()
    491 	testrig.InitTestLog()
    492 
    493 	suite.db = testrig.NewTestDB(&suite.state)
    494 	suite.state.DB = suite.db
    495 	storage := testrig.NewInMemoryStorage()
    496 	suite.state.Storage = storage
    497 
    498 	suite.testAccounts = testrig.NewTestAccounts()
    499 	suite.testStatuses = testrig.NewTestStatuses()
    500 	suite.testAttachments = testrig.NewTestAttachments()
    501 	suite.testPeople = testrig.NewTestFediPeople()
    502 	suite.testEmojis = testrig.NewTestEmojis()
    503 	suite.testReports = testrig.NewTestReports()
    504 	suite.testMentions = testrig.NewTestMentions()
    505 	suite.typeconverter = typeutils.NewConverter(suite.db)
    506 
    507 	testrig.StandardDBSetup(suite.db, nil)
    508 }
    509 
    510 func (suite *TypeUtilsTestSuite) TearDownTest() {
    511 	testrig.StandardDBTeardown(suite.db)
    512 	testrig.StopWorkers(&suite.state)
    513 }
    514 
    515 // GetProcessor is a utility function that instantiates a processor.
    516 // Useful when a test in the test suite needs to change some state.
    517 func (suite *TypeUtilsTestSuite) GetProcessor() *processing.Processor {
    518 	testrig.StartWorkers(&suite.state)
    519 	testrig.StartTimelines(
    520 		&suite.state,
    521 		visibility.NewFilter(&suite.state),
    522 		testrig.NewTestTypeConverter(suite.db),
    523 	)
    524 
    525 	httpClient := testrig.NewMockHTTPClient(nil, "../../testrig/media")
    526 	transportController := testrig.NewTestTransportController(&suite.state, httpClient)
    527 	mediaManager := testrig.NewTestMediaManager(&suite.state)
    528 	federator := testrig.NewTestFederator(&suite.state, transportController, mediaManager)
    529 	emailSender := testrig.NewEmailSender("../../web/template/", nil)
    530 	return testrig.NewTestProcessor(&suite.state, federator, emailSender, mediaManager)
    531 }