#[cfg(test)]
mod tests {
- use serial_test::serial;
-
- use crate::objects::tests::file_to_json_object;
-
use super::*;
+ use crate::objects::tests::file_to_json_object;
+ use serial_test::serial;
#[actix_rt::test]
#[serial]
async fn test_parse_pleroma_create_comment() {
- let _: CreateOrUpdateComment = file_to_json_object("assets/pleroma-create-comment.json");
+ file_to_json_object::<CreateOrUpdateComment>("assets/pleroma/activities/create-note.json");
}
}
#[cfg(test)]
pub(crate) mod tests {
- use assert_json_diff::assert_json_include;
- use serial_test::serial;
-
+ use super::*;
use crate::objects::{
community::ApubCommunity,
+ person::ApubPerson,
+ post::ApubPost,
tests::{file_to_json_object, init_context},
};
-
- use super::*;
- use crate::objects::{person::ApubPerson, post::ApubPost};
+ use assert_json_diff::assert_json_include;
+ use serial_test::serial;
pub(crate) async fn prepare_comment_test(
url: &Url,
context: &LemmyContext,
) -> (ApubPerson, ApubCommunity, ApubPost) {
- let person_json = file_to_json_object("assets/lemmy-person.json");
+ let person_json = file_to_json_object("assets/lemmy/objects/person.json");
let person = ApubPerson::from_apub(&person_json, context, url, &mut 0)
.await
.unwrap();
- let community_json = file_to_json_object("assets/lemmy-community.json");
+ let community_json = file_to_json_object("assets/lemmy/objects/group.json");
let community = ApubCommunity::from_apub(&community_json, context, url, &mut 0)
.await
.unwrap();
- let post_json = file_to_json_object("assets/lemmy-post.json");
+ let post_json = file_to_json_object("assets/lemmy/objects/page.json");
let post = ApubPost::from_apub(&post_json, context, url, &mut 0)
.await
.unwrap();
let url = Url::parse("https://enterprise.lemmy.ml/comment/38741").unwrap();
let data = prepare_comment_test(&url, &context).await;
- let json = file_to_json_object("assets/lemmy-comment.json");
+ let json = file_to_json_object("assets/lemmy/objects/note.json");
let mut request_counter = 0;
let comment = ApubComment::from_apub(&json, &context, &url, &mut request_counter)
.await
let pleroma_url =
Url::parse("https://queer.hacktivis.me/objects/8d4973f4-53de-49cd-8c27-df160e16a9c2")
.unwrap();
- let person_json = file_to_json_object("assets/pleroma-person.json");
+ let person_json = file_to_json_object("assets/pleroma/objects/person.json");
ApubPerson::from_apub(&person_json, &context, &pleroma_url, &mut 0)
.await
.unwrap();
- let json = file_to_json_object("assets/pleroma-comment.json");
+ let json = file_to_json_object("assets/pleroma/objects/note.json");
let mut request_counter = 0;
let comment = ApubComment::from_apub(&json, &context, &pleroma_url, &mut request_counter)
.await
#[cfg(test)]
mod tests {
+ use super::*;
+ use crate::objects::tests::{file_to_json_object, init_context};
use assert_json_diff::assert_json_include;
- use serial_test::serial;
-
use lemmy_db_schema::traits::Crud;
-
- use crate::objects::tests::{file_to_json_object, init_context};
-
- use super::*;
+ use serial_test::serial;
#[actix_rt::test]
#[serial]
async fn test_parse_lemmy_community() {
let context = init_context();
- let mut json: Group = file_to_json_object("assets/lemmy-community.json");
+ let mut json: Group = file_to_json_object("assets/lemmy/objects/group.json");
let json_orig = json.clone();
// change these links so they dont fetch over the network
json.moderators = Some(ObjectId::new(
#[serial]
async fn test_parse_lemmy_person() {
let context = init_context();
- let json = file_to_json_object("assets/lemmy-person.json");
+ let json = file_to_json_object("assets/lemmy/objects/person.json");
let url = Url::parse("https://enterprise.lemmy.ml/u/picard").unwrap();
let mut request_counter = 0;
let person = ApubPerson::from_apub(&json, &context, &url, &mut request_counter)
#[serial]
async fn test_parse_pleroma_person() {
let context = init_context();
- let json = file_to_json_object("assets/pleroma-person.json");
+ let json = file_to_json_object("assets/pleroma/objects/person.json");
let url = Url::parse("https://queer.hacktivis.me/users/lanodan").unwrap();
let mut request_counter = 0;
let person = ApubPerson::from_apub(&json, &context, &url, &mut request_counter)
async fn test_parse_lemmy_post() {
let context = init_context();
let url = Url::parse("https://enterprise.lemmy.ml/post/55143").unwrap();
- let community_json = file_to_json_object("assets/lemmy-community.json");
+ let community_json = file_to_json_object("assets/lemmy/objects/group.json");
let community = ApubCommunity::from_apub(&community_json, &context, &url, &mut 0)
.await
.unwrap();
- let person_json = file_to_json_object("assets/lemmy-person.json");
+ let person_json = file_to_json_object("assets/lemmy/objects/person.json");
let person = ApubPerson::from_apub(&person_json, &context, &url, &mut 0)
.await
.unwrap();
- let json = file_to_json_object("assets/lemmy-post.json");
+ let json = file_to_json_object("assets/lemmy/objects/page.json");
let mut request_counter = 0;
let post = ApubPost::from_apub(&json, &context, &url, &mut request_counter)
.await
use serial_test::serial;
async fn prepare_comment_test(url: &Url, context: &LemmyContext) -> (ApubPerson, ApubPerson) {
- let lemmy_person = file_to_json_object("assets/lemmy-person.json");
+ let lemmy_person = file_to_json_object("assets/lemmy/objects/person.json");
let person1 = ApubPerson::from_apub(&lemmy_person, context, url, &mut 0)
.await
.unwrap();
- let pleroma_person = file_to_json_object("assets/pleroma-person.json");
+ let pleroma_person = file_to_json_object("assets/pleroma/objects/person.json");
let pleroma_url = Url::parse("https://queer.hacktivis.me/users/lanodan").unwrap();
let person2 = ApubPerson::from_apub(&pleroma_person, context, &pleroma_url, &mut 0)
.await
let context = init_context();
let url = Url::parse("https://enterprise.lemmy.ml/private_message/1621").unwrap();
let data = prepare_comment_test(&url, &context).await;
- let json = file_to_json_object("assets/lemmy-private-message.json");
+ let json = file_to_json_object("assets/lemmy/objects/chat_message.json");
let mut request_counter = 0;
let pm = ApubPrivateMessage::from_apub(&json, &context, &url, &mut request_counter)
.await
let url = Url::parse("https://enterprise.lemmy.ml/private_message/1621").unwrap();
let data = prepare_comment_test(&url, &context).await;
let pleroma_url = Url::parse("https://queer.hacktivis.me/objects/2").unwrap();
- let json = file_to_json_object("assets/pleroma-private-message.json");
+ let json = file_to_json_object("assets/pleroma/objects/chat_message.json");
let mut request_counter = 0;
let pm = ApubPrivateMessage::from_apub(&json, &context, &pleroma_url, &mut request_counter)
.await