]> Untitled Git - lemmy.git/blob - crates/db_schema/src/impls/moderator.rs
824001deb331f71875867eb585638776e49fcc9c
[lemmy.git] / crates / db_schema / src / impls / moderator.rs
1 use crate::{source::moderator::*, traits::Crud};
2 use diesel::{dsl::*, result::Error, *};
3
4 // TODO grep for ..xxxDefault()
5
6 impl Crud for ModRemovePost {
7   type InsertForm = ModRemovePostForm;
8   type UpdateForm = ModRemovePostForm;
9   type IdType = i32;
10   fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
11     use crate::schema::mod_remove_post::dsl::*;
12     mod_remove_post.find(from_id).first::<Self>(conn)
13   }
14
15   fn create(conn: &mut PgConnection, form: &ModRemovePostForm) -> Result<Self, Error> {
16     use crate::schema::mod_remove_post::dsl::*;
17     insert_into(mod_remove_post)
18       .values(form)
19       .get_result::<Self>(conn)
20   }
21
22   fn update(
23     conn: &mut PgConnection,
24     from_id: i32,
25     form: &ModRemovePostForm,
26   ) -> Result<Self, Error> {
27     use crate::schema::mod_remove_post::dsl::*;
28     diesel::update(mod_remove_post.find(from_id))
29       .set(form)
30       .get_result::<Self>(conn)
31   }
32 }
33
34 impl Crud for ModLockPost {
35   type InsertForm = ModLockPostForm;
36   type UpdateForm = ModLockPostForm;
37   type IdType = i32;
38   fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
39     use crate::schema::mod_lock_post::dsl::*;
40     mod_lock_post.find(from_id).first::<Self>(conn)
41   }
42
43   fn create(conn: &mut PgConnection, form: &ModLockPostForm) -> Result<Self, Error> {
44     use crate::schema::mod_lock_post::dsl::*;
45     insert_into(mod_lock_post)
46       .values(form)
47       .get_result::<Self>(conn)
48   }
49
50   fn update(conn: &mut PgConnection, from_id: i32, form: &ModLockPostForm) -> Result<Self, Error> {
51     use crate::schema::mod_lock_post::dsl::*;
52     diesel::update(mod_lock_post.find(from_id))
53       .set(form)
54       .get_result::<Self>(conn)
55   }
56 }
57
58 impl Crud for ModStickyPost {
59   type InsertForm = ModStickyPostForm;
60   type UpdateForm = ModStickyPostForm;
61   type IdType = i32;
62   fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
63     use crate::schema::mod_sticky_post::dsl::*;
64     mod_sticky_post.find(from_id).first::<Self>(conn)
65   }
66
67   fn create(conn: &mut PgConnection, form: &ModStickyPostForm) -> Result<Self, Error> {
68     use crate::schema::mod_sticky_post::dsl::*;
69     insert_into(mod_sticky_post)
70       .values(form)
71       .get_result::<Self>(conn)
72   }
73
74   fn update(
75     conn: &mut PgConnection,
76     from_id: i32,
77     form: &ModStickyPostForm,
78   ) -> Result<Self, Error> {
79     use crate::schema::mod_sticky_post::dsl::*;
80     diesel::update(mod_sticky_post.find(from_id))
81       .set(form)
82       .get_result::<Self>(conn)
83   }
84 }
85
86 impl Crud for ModRemoveComment {
87   type InsertForm = ModRemoveCommentForm;
88   type UpdateForm = ModRemoveCommentForm;
89   type IdType = i32;
90   fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
91     use crate::schema::mod_remove_comment::dsl::*;
92     mod_remove_comment.find(from_id).first::<Self>(conn)
93   }
94
95   fn create(conn: &mut PgConnection, form: &ModRemoveCommentForm) -> Result<Self, Error> {
96     use crate::schema::mod_remove_comment::dsl::*;
97     insert_into(mod_remove_comment)
98       .values(form)
99       .get_result::<Self>(conn)
100   }
101
102   fn update(
103     conn: &mut PgConnection,
104     from_id: i32,
105     form: &ModRemoveCommentForm,
106   ) -> Result<Self, Error> {
107     use crate::schema::mod_remove_comment::dsl::*;
108     diesel::update(mod_remove_comment.find(from_id))
109       .set(form)
110       .get_result::<Self>(conn)
111   }
112 }
113
114 impl Crud for ModRemoveCommunity {
115   type InsertForm = ModRemoveCommunityForm;
116   type UpdateForm = ModRemoveCommunityForm;
117   type IdType = i32;
118   fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
119     use crate::schema::mod_remove_community::dsl::*;
120     mod_remove_community.find(from_id).first::<Self>(conn)
121   }
122
123   fn create(conn: &mut PgConnection, form: &ModRemoveCommunityForm) -> Result<Self, Error> {
124     use crate::schema::mod_remove_community::dsl::*;
125     insert_into(mod_remove_community)
126       .values(form)
127       .get_result::<Self>(conn)
128   }
129
130   fn update(
131     conn: &mut PgConnection,
132     from_id: i32,
133     form: &ModRemoveCommunityForm,
134   ) -> Result<Self, Error> {
135     use crate::schema::mod_remove_community::dsl::*;
136     diesel::update(mod_remove_community.find(from_id))
137       .set(form)
138       .get_result::<Self>(conn)
139   }
140 }
141
142 impl Crud for ModBanFromCommunity {
143   type InsertForm = ModBanFromCommunityForm;
144   type UpdateForm = ModBanFromCommunityForm;
145   type IdType = i32;
146   fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
147     use crate::schema::mod_ban_from_community::dsl::*;
148     mod_ban_from_community.find(from_id).first::<Self>(conn)
149   }
150
151   fn create(conn: &mut PgConnection, form: &ModBanFromCommunityForm) -> Result<Self, Error> {
152     use crate::schema::mod_ban_from_community::dsl::*;
153     insert_into(mod_ban_from_community)
154       .values(form)
155       .get_result::<Self>(conn)
156   }
157
158   fn update(
159     conn: &mut PgConnection,
160     from_id: i32,
161     form: &ModBanFromCommunityForm,
162   ) -> Result<Self, Error> {
163     use crate::schema::mod_ban_from_community::dsl::*;
164     diesel::update(mod_ban_from_community.find(from_id))
165       .set(form)
166       .get_result::<Self>(conn)
167   }
168 }
169
170 impl Crud for ModBan {
171   type InsertForm = ModBanForm;
172   type UpdateForm = ModBanForm;
173   type IdType = i32;
174   fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
175     use crate::schema::mod_ban::dsl::*;
176     mod_ban.find(from_id).first::<Self>(conn)
177   }
178
179   fn create(conn: &mut PgConnection, form: &ModBanForm) -> Result<Self, Error> {
180     use crate::schema::mod_ban::dsl::*;
181     insert_into(mod_ban).values(form).get_result::<Self>(conn)
182   }
183
184   fn update(conn: &mut PgConnection, from_id: i32, form: &ModBanForm) -> Result<Self, Error> {
185     use crate::schema::mod_ban::dsl::*;
186     diesel::update(mod_ban.find(from_id))
187       .set(form)
188       .get_result::<Self>(conn)
189   }
190 }
191
192 impl Crud for ModHideCommunity {
193   type InsertForm = ModHideCommunityForm;
194   type UpdateForm = ModHideCommunityForm;
195   type IdType = i32;
196
197   fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
198     use crate::schema::mod_hide_community::dsl::*;
199     mod_hide_community.find(from_id).first::<Self>(conn)
200   }
201
202   fn create(conn: &mut PgConnection, form: &ModHideCommunityForm) -> Result<Self, Error> {
203     use crate::schema::mod_hide_community::dsl::*;
204     insert_into(mod_hide_community)
205       .values(form)
206       .get_result::<Self>(conn)
207   }
208
209   fn update(
210     conn: &mut PgConnection,
211     from_id: i32,
212     form: &ModHideCommunityForm,
213   ) -> Result<Self, Error> {
214     use crate::schema::mod_hide_community::dsl::*;
215     diesel::update(mod_hide_community.find(from_id))
216       .set(form)
217       .get_result::<Self>(conn)
218   }
219 }
220
221 impl Crud for ModAddCommunity {
222   type InsertForm = ModAddCommunityForm;
223   type UpdateForm = ModAddCommunityForm;
224   type IdType = i32;
225   fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
226     use crate::schema::mod_add_community::dsl::*;
227     mod_add_community.find(from_id).first::<Self>(conn)
228   }
229
230   fn create(conn: &mut PgConnection, form: &ModAddCommunityForm) -> Result<Self, Error> {
231     use crate::schema::mod_add_community::dsl::*;
232     insert_into(mod_add_community)
233       .values(form)
234       .get_result::<Self>(conn)
235   }
236
237   fn update(
238     conn: &mut PgConnection,
239     from_id: i32,
240     form: &ModAddCommunityForm,
241   ) -> Result<Self, Error> {
242     use crate::schema::mod_add_community::dsl::*;
243     diesel::update(mod_add_community.find(from_id))
244       .set(form)
245       .get_result::<Self>(conn)
246   }
247 }
248
249 impl Crud for ModTransferCommunity {
250   type InsertForm = ModTransferCommunityForm;
251   type UpdateForm = ModTransferCommunityForm;
252   type IdType = i32;
253   fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
254     use crate::schema::mod_transfer_community::dsl::*;
255     mod_transfer_community.find(from_id).first::<Self>(conn)
256   }
257
258   fn create(conn: &mut PgConnection, form: &ModTransferCommunityForm) -> Result<Self, Error> {
259     use crate::schema::mod_transfer_community::dsl::*;
260     insert_into(mod_transfer_community)
261       .values(form)
262       .get_result::<Self>(conn)
263   }
264
265   fn update(
266     conn: &mut PgConnection,
267     from_id: i32,
268     form: &ModTransferCommunityForm,
269   ) -> Result<Self, Error> {
270     use crate::schema::mod_transfer_community::dsl::*;
271     diesel::update(mod_transfer_community.find(from_id))
272       .set(form)
273       .get_result::<Self>(conn)
274   }
275 }
276
277 impl Crud for ModAdd {
278   type InsertForm = ModAddForm;
279   type UpdateForm = ModAddForm;
280   type IdType = i32;
281   fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
282     use crate::schema::mod_add::dsl::*;
283     mod_add.find(from_id).first::<Self>(conn)
284   }
285
286   fn create(conn: &mut PgConnection, form: &ModAddForm) -> Result<Self, Error> {
287     use crate::schema::mod_add::dsl::*;
288     insert_into(mod_add).values(form).get_result::<Self>(conn)
289   }
290
291   fn update(conn: &mut PgConnection, from_id: i32, form: &ModAddForm) -> Result<Self, Error> {
292     use crate::schema::mod_add::dsl::*;
293     diesel::update(mod_add.find(from_id))
294       .set(form)
295       .get_result::<Self>(conn)
296   }
297 }
298
299 impl Crud for AdminPurgePerson {
300   type InsertForm = AdminPurgePersonForm;
301   type UpdateForm = AdminPurgePersonForm;
302   type IdType = i32;
303   fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
304     use crate::schema::admin_purge_person::dsl::*;
305     admin_purge_person.find(from_id).first::<Self>(conn)
306   }
307
308   fn create(conn: &mut PgConnection, form: &Self::InsertForm) -> Result<Self, Error> {
309     use crate::schema::admin_purge_person::dsl::*;
310     insert_into(admin_purge_person)
311       .values(form)
312       .get_result::<Self>(conn)
313   }
314
315   fn update(conn: &mut PgConnection, from_id: i32, form: &Self::InsertForm) -> Result<Self, Error> {
316     use crate::schema::admin_purge_person::dsl::*;
317     diesel::update(admin_purge_person.find(from_id))
318       .set(form)
319       .get_result::<Self>(conn)
320   }
321 }
322
323 impl Crud for AdminPurgeCommunity {
324   type InsertForm = AdminPurgeCommunityForm;
325   type UpdateForm = AdminPurgeCommunityForm;
326   type IdType = i32;
327   fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
328     use crate::schema::admin_purge_community::dsl::*;
329     admin_purge_community.find(from_id).first::<Self>(conn)
330   }
331
332   fn create(conn: &mut PgConnection, form: &Self::InsertForm) -> Result<Self, Error> {
333     use crate::schema::admin_purge_community::dsl::*;
334     insert_into(admin_purge_community)
335       .values(form)
336       .get_result::<Self>(conn)
337   }
338
339   fn update(conn: &mut PgConnection, from_id: i32, form: &Self::InsertForm) -> Result<Self, Error> {
340     use crate::schema::admin_purge_community::dsl::*;
341     diesel::update(admin_purge_community.find(from_id))
342       .set(form)
343       .get_result::<Self>(conn)
344   }
345 }
346
347 impl Crud for AdminPurgePost {
348   type InsertForm = AdminPurgePostForm;
349   type UpdateForm = AdminPurgePostForm;
350   type IdType = i32;
351   fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
352     use crate::schema::admin_purge_post::dsl::*;
353     admin_purge_post.find(from_id).first::<Self>(conn)
354   }
355
356   fn create(conn: &mut PgConnection, form: &Self::InsertForm) -> Result<Self, Error> {
357     use crate::schema::admin_purge_post::dsl::*;
358     insert_into(admin_purge_post)
359       .values(form)
360       .get_result::<Self>(conn)
361   }
362
363   fn update(conn: &mut PgConnection, from_id: i32, form: &Self::InsertForm) -> Result<Self, Error> {
364     use crate::schema::admin_purge_post::dsl::*;
365     diesel::update(admin_purge_post.find(from_id))
366       .set(form)
367       .get_result::<Self>(conn)
368   }
369 }
370
371 impl Crud for AdminPurgeComment {
372   type InsertForm = AdminPurgeCommentForm;
373   type UpdateForm = AdminPurgeCommentForm;
374   type IdType = i32;
375   fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
376     use crate::schema::admin_purge_comment::dsl::*;
377     admin_purge_comment.find(from_id).first::<Self>(conn)
378   }
379
380   fn create(conn: &mut PgConnection, form: &Self::InsertForm) -> Result<Self, Error> {
381     use crate::schema::admin_purge_comment::dsl::*;
382     insert_into(admin_purge_comment)
383       .values(form)
384       .get_result::<Self>(conn)
385   }
386
387   fn update(conn: &mut PgConnection, from_id: i32, form: &Self::InsertForm) -> Result<Self, Error> {
388     use crate::schema::admin_purge_comment::dsl::*;
389     diesel::update(admin_purge_comment.find(from_id))
390       .set(form)
391       .get_result::<Self>(conn)
392   }
393 }
394
395 #[cfg(test)]
396 mod tests {
397   use crate::{
398     source::{comment::*, community::*, instance::Instance, moderator::*, person::*, post::*},
399     traits::Crud,
400     utils::establish_unpooled_connection,
401   };
402   use serial_test::serial;
403
404   // use Crud;
405   #[test]
406   #[serial]
407   fn test_crud() {
408     let conn = &mut establish_unpooled_connection();
409
410     let inserted_instance = Instance::create(conn, "my_domain.tld").unwrap();
411
412     let new_mod = PersonInsertForm::builder()
413       .name("the mod".into())
414       .public_key("pubkey".to_string())
415       .instance_id(inserted_instance.id)
416       .build();
417
418     let inserted_mod = Person::create(conn, &new_mod).unwrap();
419
420     let new_person = PersonInsertForm::builder()
421       .name("jim2".into())
422       .public_key("pubkey".to_string())
423       .instance_id(inserted_instance.id)
424       .build();
425
426     let inserted_person = Person::create(conn, &new_person).unwrap();
427
428     let new_community = CommunityInsertForm::builder()
429       .name("mod_community".to_string())
430       .title("nada".to_owned())
431       .public_key("pubkey".to_string())
432       .instance_id(inserted_instance.id)
433       .build();
434
435     let inserted_community = Community::create(conn, &new_community).unwrap();
436
437     let new_post = PostInsertForm::builder()
438       .name("A test post thweep".into())
439       .creator_id(inserted_person.id)
440       .community_id(inserted_community.id)
441       .build();
442
443     let inserted_post = Post::create(conn, &new_post).unwrap();
444
445     let comment_form = CommentInsertForm::builder()
446       .content("A test comment".into())
447       .creator_id(inserted_person.id)
448       .post_id(inserted_post.id)
449       .build();
450
451     let inserted_comment = Comment::create(conn, &comment_form, None).unwrap();
452
453     // Now the actual tests
454
455     // remove post
456     let mod_remove_post_form = ModRemovePostForm {
457       mod_person_id: inserted_mod.id,
458       post_id: inserted_post.id,
459       reason: None,
460       removed: None,
461     };
462     let inserted_mod_remove_post = ModRemovePost::create(conn, &mod_remove_post_form).unwrap();
463     let read_mod_remove_post = ModRemovePost::read(conn, inserted_mod_remove_post.id).unwrap();
464     let expected_mod_remove_post = ModRemovePost {
465       id: inserted_mod_remove_post.id,
466       post_id: inserted_post.id,
467       mod_person_id: inserted_mod.id,
468       reason: None,
469       removed: Some(true),
470       when_: inserted_mod_remove_post.when_,
471     };
472
473     // lock post
474
475     let mod_lock_post_form = ModLockPostForm {
476       mod_person_id: inserted_mod.id,
477       post_id: inserted_post.id,
478       locked: None,
479     };
480     let inserted_mod_lock_post = ModLockPost::create(conn, &mod_lock_post_form).unwrap();
481     let read_mod_lock_post = ModLockPost::read(conn, inserted_mod_lock_post.id).unwrap();
482     let expected_mod_lock_post = ModLockPost {
483       id: inserted_mod_lock_post.id,
484       post_id: inserted_post.id,
485       mod_person_id: inserted_mod.id,
486       locked: Some(true),
487       when_: inserted_mod_lock_post.when_,
488     };
489
490     // sticky post
491
492     let mod_sticky_post_form = ModStickyPostForm {
493       mod_person_id: inserted_mod.id,
494       post_id: inserted_post.id,
495       stickied: None,
496     };
497     let inserted_mod_sticky_post = ModStickyPost::create(conn, &mod_sticky_post_form).unwrap();
498     let read_mod_sticky_post = ModStickyPost::read(conn, inserted_mod_sticky_post.id).unwrap();
499     let expected_mod_sticky_post = ModStickyPost {
500       id: inserted_mod_sticky_post.id,
501       post_id: inserted_post.id,
502       mod_person_id: inserted_mod.id,
503       stickied: Some(true),
504       when_: inserted_mod_sticky_post.when_,
505     };
506
507     // comment
508
509     let mod_remove_comment_form = ModRemoveCommentForm {
510       mod_person_id: inserted_mod.id,
511       comment_id: inserted_comment.id,
512       reason: None,
513       removed: None,
514     };
515     let inserted_mod_remove_comment =
516       ModRemoveComment::create(conn, &mod_remove_comment_form).unwrap();
517     let read_mod_remove_comment =
518       ModRemoveComment::read(conn, inserted_mod_remove_comment.id).unwrap();
519     let expected_mod_remove_comment = ModRemoveComment {
520       id: inserted_mod_remove_comment.id,
521       comment_id: inserted_comment.id,
522       mod_person_id: inserted_mod.id,
523       reason: None,
524       removed: Some(true),
525       when_: inserted_mod_remove_comment.when_,
526     };
527
528     // community
529
530     let mod_remove_community_form = ModRemoveCommunityForm {
531       mod_person_id: inserted_mod.id,
532       community_id: inserted_community.id,
533       reason: None,
534       removed: None,
535       expires: None,
536     };
537     let inserted_mod_remove_community =
538       ModRemoveCommunity::create(conn, &mod_remove_community_form).unwrap();
539     let read_mod_remove_community =
540       ModRemoveCommunity::read(conn, inserted_mod_remove_community.id).unwrap();
541     let expected_mod_remove_community = ModRemoveCommunity {
542       id: inserted_mod_remove_community.id,
543       community_id: inserted_community.id,
544       mod_person_id: inserted_mod.id,
545       reason: None,
546       removed: Some(true),
547       expires: None,
548       when_: inserted_mod_remove_community.when_,
549     };
550
551     // ban from community
552
553     let mod_ban_from_community_form = ModBanFromCommunityForm {
554       mod_person_id: inserted_mod.id,
555       other_person_id: inserted_person.id,
556       community_id: inserted_community.id,
557       reason: None,
558       banned: None,
559       expires: None,
560     };
561     let inserted_mod_ban_from_community =
562       ModBanFromCommunity::create(conn, &mod_ban_from_community_form).unwrap();
563     let read_mod_ban_from_community =
564       ModBanFromCommunity::read(conn, inserted_mod_ban_from_community.id).unwrap();
565     let expected_mod_ban_from_community = ModBanFromCommunity {
566       id: inserted_mod_ban_from_community.id,
567       community_id: inserted_community.id,
568       mod_person_id: inserted_mod.id,
569       other_person_id: inserted_person.id,
570       reason: None,
571       banned: Some(true),
572       expires: None,
573       when_: inserted_mod_ban_from_community.when_,
574     };
575
576     // ban
577
578     let mod_ban_form = ModBanForm {
579       mod_person_id: inserted_mod.id,
580       other_person_id: inserted_person.id,
581       reason: None,
582       banned: None,
583       expires: None,
584     };
585     let inserted_mod_ban = ModBan::create(conn, &mod_ban_form).unwrap();
586     let read_mod_ban = ModBan::read(conn, inserted_mod_ban.id).unwrap();
587     let expected_mod_ban = ModBan {
588       id: inserted_mod_ban.id,
589       mod_person_id: inserted_mod.id,
590       other_person_id: inserted_person.id,
591       reason: None,
592       banned: Some(true),
593       expires: None,
594       when_: inserted_mod_ban.when_,
595     };
596
597     // mod add community
598
599     let mod_add_community_form = ModAddCommunityForm {
600       mod_person_id: inserted_mod.id,
601       other_person_id: inserted_person.id,
602       community_id: inserted_community.id,
603       removed: None,
604     };
605     let inserted_mod_add_community =
606       ModAddCommunity::create(conn, &mod_add_community_form).unwrap();
607     let read_mod_add_community =
608       ModAddCommunity::read(conn, inserted_mod_add_community.id).unwrap();
609     let expected_mod_add_community = ModAddCommunity {
610       id: inserted_mod_add_community.id,
611       community_id: inserted_community.id,
612       mod_person_id: inserted_mod.id,
613       other_person_id: inserted_person.id,
614       removed: Some(false),
615       when_: inserted_mod_add_community.when_,
616     };
617
618     // mod add
619
620     let mod_add_form = ModAddForm {
621       mod_person_id: inserted_mod.id,
622       other_person_id: inserted_person.id,
623       removed: None,
624     };
625     let inserted_mod_add = ModAdd::create(conn, &mod_add_form).unwrap();
626     let read_mod_add = ModAdd::read(conn, inserted_mod_add.id).unwrap();
627     let expected_mod_add = ModAdd {
628       id: inserted_mod_add.id,
629       mod_person_id: inserted_mod.id,
630       other_person_id: inserted_person.id,
631       removed: Some(false),
632       when_: inserted_mod_add.when_,
633     };
634
635     Comment::delete(conn, inserted_comment.id).unwrap();
636     Post::delete(conn, inserted_post.id).unwrap();
637     Community::delete(conn, inserted_community.id).unwrap();
638     Person::delete(conn, inserted_person.id).unwrap();
639     Person::delete(conn, inserted_mod.id).unwrap();
640     Instance::delete(conn, inserted_instance.id).unwrap();
641
642     assert_eq!(expected_mod_remove_post, read_mod_remove_post);
643     assert_eq!(expected_mod_lock_post, read_mod_lock_post);
644     assert_eq!(expected_mod_sticky_post, read_mod_sticky_post);
645     assert_eq!(expected_mod_remove_comment, read_mod_remove_comment);
646     assert_eq!(expected_mod_remove_community, read_mod_remove_community);
647     assert_eq!(expected_mod_ban_from_community, read_mod_ban_from_community);
648     assert_eq!(expected_mod_ban, read_mod_ban);
649     assert_eq!(expected_mod_add_community, read_mod_add_community);
650     assert_eq!(expected_mod_add, read_mod_add);
651   }
652 }