]> Untitled Git - lemmy.git/blob - crates/apub/src/protocol/objects/mod.rs
Test pleroma follow (#1988)
[lemmy.git] / crates / apub / src / protocol / objects / mod.rs
1 use serde::{Deserialize, Serialize};
2 use url::Url;
3
4 pub(crate) mod chat_message;
5 pub(crate) mod group;
6 pub(crate) mod note;
7 pub(crate) mod page;
8 pub(crate) mod person;
9 pub(crate) mod tombstone;
10
11 #[derive(Clone, Debug, Deserialize, Serialize)]
12 #[serde(rename_all = "camelCase")]
13 pub struct Endpoints {
14   #[serde(skip_serializing_if = "Option::is_none")]
15   pub shared_inbox: Option<Url>,
16 }
17
18 #[cfg(test)]
19 mod tests {
20   use crate::{
21     context::WithContext,
22     objects::tests::file_to_json_object,
23     protocol::{
24       objects::{chat_message::ChatMessage, group::Group, note::Note, page::Page, person::Person},
25       tests::test_parse_lemmy_item,
26     },
27   };
28
29   #[actix_rt::test]
30   async fn test_parse_object() {
31     test_parse_lemmy_item::<Person>("assets/lemmy/objects/person.json");
32     test_parse_lemmy_item::<Group>("assets/lemmy/objects/group.json");
33     test_parse_lemmy_item::<Page>("assets/lemmy/objects/page.json");
34     test_parse_lemmy_item::<Note>("assets/lemmy/objects/note.json");
35     test_parse_lemmy_item::<ChatMessage>("assets/lemmy/objects/chat_message.json");
36
37     file_to_json_object::<WithContext<Person>>("assets/pleroma/objects/person.json");
38     file_to_json_object::<WithContext<Note>>("assets/pleroma/objects/note.json");
39     file_to_json_object::<WithContext<ChatMessage>>("assets/pleroma/objects/chat_message.json");
40
41     file_to_json_object::<WithContext<Person>>("assets/smithereen/objects/person.json");
42     file_to_json_object::<Note>("assets/smithereen/objects/note.json");
43
44     file_to_json_object::<Person>("assets/mastodon/objects/person.json");
45     file_to_json_object::<Note>("assets/mastodon/objects/note.json");
46   }
47 }