Add test for Follow::build_undo07()
This commit is contained in:
parent
9ca975113c
commit
5f91345d69
@ -4,7 +4,7 @@ use crate::{
|
||||
};
|
||||
use activitypub::activity::{Accept, Follow as FollowAct, Undo};
|
||||
use activitystreams::{
|
||||
activity::{Accept as Accept07, Follow as FollowAct07},
|
||||
activity::{Accept as Accept07, Follow as FollowAct07, Undo as Undo07},
|
||||
base::AnyBase,
|
||||
iri_string::types::IriString,
|
||||
prelude::*,
|
||||
@ -452,4 +452,26 @@ mod tests {
|
||||
Ok(())
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn build_undo07() {
|
||||
let conn = db();
|
||||
conn.test_transaction::<_, Error, _>(|| {
|
||||
let (follow, _following, _follower, _users) = prepare_activity(&conn);
|
||||
let act = follow.build_undo07(&conn)?;
|
||||
|
||||
let expected = json!({
|
||||
"actor": "https://plu.me/@/other/",
|
||||
"cc": ["https://www.w3.org/ns/activitystreams#Public"],
|
||||
"id": format!("https://plu.me/follows/{}/undo", follow.id),
|
||||
"object": format!("https://plu.me/follows/{}", follow.id),
|
||||
"to": ["https://plu.me/@/user/"],
|
||||
"type": "Undo"
|
||||
});
|
||||
|
||||
assert_json_eq!(to_value(act)?, expected);
|
||||
|
||||
Ok(())
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user