]> Untitled Git - lemmy.git/blobdiff - crates/apub/src/protocol/activities/mod.rs
Diesel 2.0.0 upgrade (#2452)
[lemmy.git] / crates / apub / src / protocol / activities / mod.rs
index 38c9e345df3e27455fd9427cc851116536ab89e7..324c8b68f3be5c43d72535bee18aca5934905707 100644 (file)
@@ -8,7 +8,7 @@ pub mod deletion;
 pub mod following;
 pub mod voting;
 
-#[derive(Clone, Debug, Display, Deserialize, Serialize, PartialEq)]
+#[derive(Clone, Debug, Display, Deserialize, Serialize, PartialEq, Eq)]
 pub enum CreateOrUpdateType {
   Create,
   Update,
@@ -18,10 +18,11 @@ pub enum CreateOrUpdateType {
 mod tests {
   use crate::protocol::{
     activities::{
+      community::announce::AnnounceActivity,
       create_or_update::{comment::CreateOrUpdateComment, post::CreateOrUpdatePost},
       deletion::delete::Delete,
       following::{follow::FollowCommunity, undo_follow::UndoFollowCommunity},
-      voting::vote::Vote,
+      voting::{undo_vote::UndoVote, vote::Vote},
     },
     tests::test_json,
   };
@@ -44,17 +45,27 @@ mod tests {
     test_json::<Delete>("assets/mastodon/activities/delete.json").unwrap();
     test_json::<FollowCommunity>("assets/mastodon/activities/follow.json").unwrap();
     test_json::<UndoFollowCommunity>("assets/mastodon/activities/undo_follow.json").unwrap();
+    test_json::<Vote>("assets/mastodon/activities/like_page.json").unwrap();
+    test_json::<UndoVote>("assets/mastodon/activities/undo_like_page.json").unwrap();
   }
 
   #[test]
   fn test_parse_lotide_activities() {
     test_json::<CreateOrUpdatePost>("assets/lotide/activities/create_page.json").unwrap();
+    test_json::<CreateOrUpdatePost>("assets/lotide/activities/create_page_image.json").unwrap();
     test_json::<CreateOrUpdateComment>("assets/lotide/activities/create_note_reply.json").unwrap();
   }
 
   #[test]
   fn test_parse_friendica_activities() {
+    test_json::<CreateOrUpdatePost>("assets/friendica/activities/create_page_1.json").unwrap();
+    test_json::<CreateOrUpdatePost>("assets/friendica/activities/create_page_2.json").unwrap();
     test_json::<CreateOrUpdateComment>("assets/friendica/activities/create_note.json").unwrap();
+    test_json::<CreateOrUpdateComment>("assets/friendica/activities/update_note.json").unwrap();
+    test_json::<Delete>("assets/friendica/activities/delete.json").unwrap();
+    test_json::<Vote>("assets/friendica/activities/like_page.json").unwrap();
+    test_json::<Vote>("assets/friendica/activities/dislike_page.json").unwrap();
+    test_json::<UndoVote>("assets/friendica/activities/undo_dislike_page.json").unwrap();
   }
 
   #[test]
@@ -63,4 +74,9 @@ mod tests {
     test_json::<CreateOrUpdateComment>("assets/gnusocial/activities/create_note.json").unwrap();
     test_json::<Vote>("assets/gnusocial/activities/like_note.json").unwrap();
   }
+
+  #[test]
+  fn test_parse_peertube_activities() {
+    test_json::<AnnounceActivity>("assets/peertube/activities/announce_video.json").unwrap();
+  }
 }