Use WithContext in apub tests where possible

This commit is contained in:
Felix Ableitner 2021-12-11 15:23:42 +01:00
parent bcb0462dae
commit 6cd750cedb
2 changed files with 12 additions and 6 deletions

View file

@ -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},
@ -25,8 +26,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");
} }
} }

View file

@ -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},
@ -35,11 +36,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");