commit: fb0743d7199947e310e396bfae7e733a5bb2359a
parent d249eb7c5cfce9f1d8dc13deb9fa5376244f5d27
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Tue, 4 Apr 2023 17:20:43 +0200
Add tests
Diffstat:
4 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
@@ -28,6 +28,10 @@ WriteMakefile(
'MIME::Base64' => 0,
'Scalar::Util' => 0,
},
+ TEST_REQUIRES => {
+ 'Test::More' => 0,
+ 'Test::Output' => 0,
+ },
META_MERGE => {
'meta-spec' => {version => 2},
release_status => 'stable',
diff --git a/t/pleroma.t b/t/pleroma.t
@@ -0,0 +1,28 @@
+#!/usr/bin/env perl
+# AP-Client: CLI-based client / toolbox for ActivityPub
+# Copyright © 2020-2023 AP-Client Authors <https://hacktivis.me/git/ap-client/>
+# SPDX-License-Identifier: BSD-3-Clause
+use strict;
+use utf8;
+use open ":std", ":encoding(UTF-8)";
+
+use Test::More tests => 1;
+use Test::Output;
+
+use JSON;
+use ActivityPub::PrettyPrint qw(print_object);
+
+# Read whole files
+undef $/;
+
+open(USER_JSON, '<:encoding(UTF-8)', 't/pleroma_user.json') or die "$!";
+
+my $object = decode_json(<USER_JSON>) or die "$!";
+
+close(USER_JSON);
+
+open(USER_TXT, '<:encoding(UTF-8)', 't/pleroma_user.out') or die "$!";
+
+output_is(sub { print_object(1, $object) }, <USER_TXT>, '', 'Test printing pleroma user');
+
+close(USER_TXT);
diff --git a/t/pleroma_user.json b/t/pleroma_user.json
@@ -0,0 +1 @@
+{"@context":["https://www.w3.org/ns/activitystreams","https://queer.hacktivis.me/schemas/litepub-0.1.jsonld",{"@language":"und"}],"alsoKnownAs":[],"attachment":[],"capabilities":{"acceptsChatMessages":true},"discoverable":true,"endpoints":{"oauthAuthorizationEndpoint":"https://queer.hacktivis.me/oauth/authorize","oauthRegistrationEndpoint":"https://queer.hacktivis.me/api/v1/apps","oauthTokenEndpoint":"https://queer.hacktivis.me/oauth/token","sharedInbox":"https://queer.hacktivis.me/inbox","uploadMedia":"https://queer.hacktivis.me/api/ap/upload_media"},"featured":"https://queer.hacktivis.me/users/lanodan/collections/featured","followers":"https://queer.hacktivis.me/users/lanodan/followers","following":"https://queer.hacktivis.me/users/lanodan/following","icon":{"type":"Image","url":"https://queer.hacktivis.me/media/02eb413b-3279-4dca-a7e4-42f95025b5be/avatar_HD.png"},"id":"https://queer.hacktivis.me/users/lanodan","image":{"type":"Image","url":"https://queer.hacktivis.me/media/37b6ce56-8c24-4e64-bd70-a76e84ab0c69/53a48a3a49ed5e5637a84e4f3663df17f8d764244bbc1027ba03cfc446e8b7bd.jpg"},"inbox":"https://queer.hacktivis.me/users/lanodan/inbox","manuallyApprovesFollowers":false,"name":"Haelwenn /ÑлвÑн/ :triskell: ","outbox":"https://queer.hacktivis.me/users/lanodan/outbox","preferredUsername":"lanodan","publicKey":{"id":"https://queer.hacktivis.me/users/lanodan#main-key","owner":"https://queer.hacktivis.me/users/lanodan","publicKeyPem":"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsWOgdjSMc010qvxC3njI\nXJlFWMJ5gJ8QXCW/PajYdsHPM6d+jxBNJ6zp9/tIRa2m7bWHTSkuHQ7QthOpt6vu\n+dAWpKRLS607SPLItn/qUcyXvgN+H8shfyhMxvkVs9jXdtlBsLUVE7UNpN0dxzqe\nI79QWbf7o4amgaIWGRYB+OYMnIxKt+GzIkivZdSVSYjfxNnBYkMCeUxm5EpPIxKS\nP5bBHAVRRambD5NUmyKILuC60/rYuc/C+vmgpY2HCWFS2q6o34dPr9enwL6t4b3m\nS1t/EJHk9rGaaDqSGkDEfyQI83/7SDebWKuETMKKFLZi1vMgQIFuOYCIhN6bIiZm\npQIDAQAB\n-----END PUBLIC KEY-----\n\n"},"summary":"---<br/>Website: <a href=\"https://hacktivis.me/\">https://hacktivis.me/</a><br/>Lang: Français(natif), English(fluent), LSF(ð¤~ð), ÑÑÑÑкий (еле-еле)<br/>Donate via LiberaPay: <a href=\"https://liberapay.com/lanodan_\">https://liberapay.com/lanodan_</a><br/><br/>Pronouns: meh, pick any, have fun<br/>Timezone: Let's say Mars, I have a non-24h cycle<br/>Dayjob: None<br/>Alts: <span class=\"h-card\"><a class=\"u-url mention\" data-user=\"9o9p23LNEOYTzkgK6C\" href=\"https://shitposter.club/users/lanodan\" rel=\"ugc\">@<span>lanodan@shitposter.club</span></a></span>, â¦<br/>```<br/>ð¦ð¦â§ð¡â¥ :anarchy: ð¿ð§ :gentoo: :sun:<br/>Pleroma maintainer (mostly backend); BadWolf developer; Gentoo contributor; Eternal upstreamer<br/><br/>Arch users needs to pacman -R works-for-me arch-btw<br/><br/>Make the changes you want to see.<br/><br/>That person which uses HJKL in games<br/><br/>Just because computer bad: X5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*<br/><br/>banner from: <a href=\"https://soc.flyingcube.tech/objects/56f79be2-9013-4559-9826-f7dc392417db\">https://soc.flyingcube.tech/objects/56f79be2-9013-4559-9826-f7dc392417db</a><br/>Federation-bots: <a class=\"hashtag\" data-tag=\"nobot\" href=\"https://queer.hacktivis.me/tag/nobot\">#nobot</a>","tag":[{"icon":{"type":"Image","url":"https://queer.hacktivis.me/emoji/custom/symbols/anarchy.png"},"id":"https://queer.hacktivis.me/emoji/custom/symbols/anarchy.png","name":":anarchy:","type":"Emoji","updated":"1970-01-01T00:00:00Z"},{"icon":{"type":"Image","url":"https://queer.hacktivis.me/emoji/custom/gentoo.png"},"id":"https://queer.hacktivis.me/emoji/custom/gentoo.png","name":":gentoo:","type":"Emoji","updated":"1970-01-01T00:00:00Z"},{"icon":{"type":"Image","url":"https://queer.hacktivis.me/emoji/stolen/sun.png"},"id":"https://queer.hacktivis.me/emoji/stolen/sun.png","name":":sun:","type":"Emoji","updated":"1970-01-01T00:00:00Z"},{"icon":{"type":"Image","url":"https://queer.hacktivis.me/emoji/custom/breizh/triskell.png"},"id":"https://queer.hacktivis.me/emoji/custom/breizh/triskell.png","name":":triskell:","type":"Emoji","updated":"1970-01-01T00:00:00Z"}],"type":"Person","url":"https://queer.hacktivis.me/users/lanodan","vcard:bday":null}
+\ No newline at end of file
diff --git a/t/pleroma_user.out b/t/pleroma_user.out
@@ -0,0 +1,14 @@
+⇒ Person id:<https://queer.hacktivis.me/users/lanodan> “Haelwenn /элвэн/ :triskell: ” @lanodan
+ url: https://queer.hacktivis.me/users/lanodan
+ inbox: https://queer.hacktivis.me/users/lanodan/inbox
+ outbox: https://queer.hacktivis.me/users/lanodan/outbox
+ summary: ---<br/>Website: <a href="https://hacktivis.me/">https://hacktivis.me/</a><br/>Lang: Français(natif), English(fluent), LSF(🤏~👌), русский (еле-еле)<br/>Donate via LiberaPay: <a href="https://liberapay.com/lanodan_">https://liberapay.com/lanodan_</a><br/><br/>Pronouns: meh, pick any, have fun<br/>Timezone: Let's say Mars, I have a non-24h cycle<br/>Dayjob: None<br/>Alts: <span class="h-card"><a class="u-url mention" data-user="9o9p23LNEOYTzkgK6C" href="https://shitposter.club/users/lanodan" rel="ugc">@<span>lanodan@shitposter.club</span></a></span>, …<br/>```<br/>🦊🦄⚧🂡ⓥ :anarchy: 👿🐧 :gentoo: :sun:<br/>Pleroma maintainer (mostly backend); BadWolf developer; Gentoo contributor; Eternal upstreamer<br/><br/>Arch users needs to pacman -R works-for-me arch-btw<br/><br/>Make the changes you want to see.<br/><br/>That person which uses HJKL in games<br/><br/>Just because computer bad: X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*<br/><br/>banner from: <a href="https://soc.flyingcube.tech/objects/56f79be2-9013-4559-9826-f7dc392417db">https://soc.flyingcube.tech/objects/56f79be2-9013-4559-9826-f7dc392417db</a><br/>Federation-bots: <a class="hashtag" data-tag="nobot" href="https://queer.hacktivis.me/tag/nobot">#nobot</a>
+ tag:
+ ⇒ Emoji id:<https://queer.hacktivis.me/emoji/custom/symbols/anarchy.png> “:anarchy:”
+ updated: 1970-01-01T00:00:00Z
+ ⇒ Emoji id:<https://queer.hacktivis.me/emoji/custom/gentoo.png> “:gentoo:”
+ updated: 1970-01-01T00:00:00Z
+ ⇒ Emoji id:<https://queer.hacktivis.me/emoji/stolen/sun.png> “:sun:”
+ updated: 1970-01-01T00:00:00Z
+ ⇒ Emoji id:<https://queer.hacktivis.me/emoji/custom/breizh/triskell.png> “:triskell:”
+ updated: 1970-01-01T00:00:00Z
+\ No newline at end of file