activities::{verify_is_public, verify_person_in_community},
check_is_apub_id_valid,
protocol::{
- objects::{page::Page, tombstone::Tombstone},
+ objects::{
+ page::{Page, PageType},
+ tombstone::Tombstone,
+ },
ImageObject,
Source,
},
};
-use activitystreams_kinds::{object::PageType, public};
+use activitystreams_kinds::public;
use chrono::NaiveDateTime;
use lemmy_api_common::blocking;
use lemmy_apub_lib::{
) -> Result<ApubPost, LemmyError> {
let creator = page
.attributed_to
- .dereference(context, request_counter)
+ .dereference(context, context.client(), request_counter)
.await?;
let community = page.extract_community(context, request_counter).await?;
tests::{file_to_json_object, init_context},
};
use lemmy_apub_lib::activity_queue::create_activity_queue;
+ use lemmy_db_schema::source::site::Site;
use serial_test::serial;
#[actix_rt::test]
#[serial]
async fn test_parse_lemmy_post() {
- let manager = create_activity_queue();
+ let client = reqwest::Client::new().into();
+ let manager = create_activity_queue(client);
let context = init_context(manager.queue_handle().clone());
+ let (person, site) = parse_lemmy_person(&context).await;
let community = parse_lemmy_community(&context).await;
- let person = parse_lemmy_person(&context).await;
- let json = file_to_json_object("assets/lemmy/objects/page.json");
+ let json = file_to_json_object("assets/lemmy/objects/page.json").unwrap();
let url = Url::parse("https://enterprise.lemmy.ml/post/55143").unwrap();
let mut request_counter = 0;
ApubPost::verify(&json, &url, &context, &mut request_counter)
Post::delete(&*context.pool().get().unwrap(), post.id).unwrap();
Person::delete(&*context.pool().get().unwrap(), person.id).unwrap();
Community::delete(&*context.pool().get().unwrap(), community.id).unwrap();
+ Site::delete(&*context.pool().get().unwrap(), site.id).unwrap();
}
}