Test pleroma follow (#1988)
* Add test case for Pleroma follow activity (ref #1984) * Use WithContext in apub tests where possible
This commit is contained in:
parent
0ed3856ef1
commit
c6ac606f60
4 changed files with 42 additions and 12 deletions
18
crates/apub/assets/pleroma/activities/follow.json
Normal file
18
crates/apub/assets/pleroma/activities/follow.json
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"@context": [
|
||||||
|
"https://www.w3.org/ns/activitystreams",
|
||||||
|
"https://mycrowd.ca/schemas/litepub-0.1.jsonld",
|
||||||
|
{
|
||||||
|
"@language": "und"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"actor": "https://mycrowd.ca/users/kinetix",
|
||||||
|
"cc": [],
|
||||||
|
"id": "https://mycrowd.ca/activities/dab6a4d3-0db0-41ee-8aab-7bfa4929b4fd",
|
||||||
|
"object": "https://lemmy.ca/u/kinetix",
|
||||||
|
"state": "pending",
|
||||||
|
"to": [
|
||||||
|
"https://lemmy.ca/u/kinetix"
|
||||||
|
],
|
||||||
|
"type": "Follow"
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ pub mod post;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
|
context::WithContext,
|
||||||
objects::tests::file_to_json_object,
|
objects::tests::file_to_json_object,
|
||||||
protocol::{
|
protocol::{
|
||||||
activities::create_or_update::{comment::CreateOrUpdateComment, post::CreateOrUpdatePost},
|
activities::create_or_update::{comment::CreateOrUpdateComment, post::CreateOrUpdatePost},
|
||||||
|
@ -23,8 +24,12 @@ mod tests {
|
||||||
"assets/lemmy/activities/create_or_update/create_note.json",
|
"assets/lemmy/activities/create_or_update/create_note.json",
|
||||||
);
|
);
|
||||||
|
|
||||||
file_to_json_object::<CreateOrUpdateComment>("assets/pleroma/activities/create_note.json");
|
file_to_json_object::<WithContext<CreateOrUpdateComment>>(
|
||||||
file_to_json_object::<CreateOrUpdateComment>("assets/smithereen/activities/create_note.json");
|
"assets/pleroma/activities/create_note.json",
|
||||||
|
);
|
||||||
|
file_to_json_object::<WithContext<CreateOrUpdateComment>>(
|
||||||
|
"assets/smithereen/activities/create_note.json",
|
||||||
|
);
|
||||||
file_to_json_object::<CreateOrUpdateComment>("assets/mastodon/activities/create_note.json");
|
file_to_json_object::<CreateOrUpdateComment>("assets/mastodon/activities/create_note.json");
|
||||||
|
|
||||||
file_to_json_object::<CreateOrUpdatePost>("assets/lotide/activities/create_page.json");
|
file_to_json_object::<CreateOrUpdatePost>("assets/lotide/activities/create_page.json");
|
||||||
|
|
|
@ -4,13 +4,17 @@ pub mod undo_follow;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::protocol::{
|
use crate::{
|
||||||
|
context::WithContext,
|
||||||
|
objects::tests::file_to_json_object,
|
||||||
|
protocol::{
|
||||||
activities::following::{
|
activities::following::{
|
||||||
accept::AcceptFollowCommunity,
|
accept::AcceptFollowCommunity,
|
||||||
follow::FollowCommunity,
|
follow::FollowCommunity,
|
||||||
undo_follow::UndoFollowCommunity,
|
undo_follow::UndoFollowCommunity,
|
||||||
},
|
},
|
||||||
tests::test_parse_lemmy_item,
|
tests::test_parse_lemmy_item,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
|
@ -20,5 +24,7 @@ mod tests {
|
||||||
test_parse_lemmy_item::<UndoFollowCommunity>(
|
test_parse_lemmy_item::<UndoFollowCommunity>(
|
||||||
"assets/lemmy/activities/following/undo_follow.json",
|
"assets/lemmy/activities/following/undo_follow.json",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
file_to_json_object::<WithContext<FollowCommunity>>("assets/pleroma/activities/follow.json");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ pub struct Endpoints {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
|
context::WithContext,
|
||||||
objects::tests::file_to_json_object,
|
objects::tests::file_to_json_object,
|
||||||
protocol::{
|
protocol::{
|
||||||
objects::{chat_message::ChatMessage, group::Group, note::Note, page::Page, person::Person},
|
objects::{chat_message::ChatMessage, group::Group, note::Note, page::Page, person::Person},
|
||||||
|
@ -33,11 +34,11 @@ mod tests {
|
||||||
test_parse_lemmy_item::<Note>("assets/lemmy/objects/note.json");
|
test_parse_lemmy_item::<Note>("assets/lemmy/objects/note.json");
|
||||||
test_parse_lemmy_item::<ChatMessage>("assets/lemmy/objects/chat_message.json");
|
test_parse_lemmy_item::<ChatMessage>("assets/lemmy/objects/chat_message.json");
|
||||||
|
|
||||||
file_to_json_object::<Person>("assets/pleroma/objects/person.json");
|
file_to_json_object::<WithContext<Person>>("assets/pleroma/objects/person.json");
|
||||||
file_to_json_object::<Note>("assets/pleroma/objects/note.json");
|
file_to_json_object::<WithContext<Note>>("assets/pleroma/objects/note.json");
|
||||||
file_to_json_object::<ChatMessage>("assets/pleroma/objects/chat_message.json");
|
file_to_json_object::<WithContext<ChatMessage>>("assets/pleroma/objects/chat_message.json");
|
||||||
|
|
||||||
file_to_json_object::<Person>("assets/smithereen/objects/person.json");
|
file_to_json_object::<WithContext<Person>>("assets/smithereen/objects/person.json");
|
||||||
file_to_json_object::<Note>("assets/smithereen/objects/note.json");
|
file_to_json_object::<Note>("assets/smithereen/objects/note.json");
|
||||||
|
|
||||||
file_to_json_object::<Person>("assets/mastodon/objects/person.json");
|
file_to_json_object::<Person>("assets/mastodon/objects/person.json");
|
||||||
|
|
Loading…
Reference in a new issue