mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-12-23 18:40:34 +00:00
Add test for Follow::to_activity07()
This commit is contained in:
parent
ed55b66253
commit
c5656971c9
1 changed files with 28 additions and 0 deletions
|
@ -3,6 +3,12 @@ use crate::{
|
||||||
Connection, Error, Result, CONFIG,
|
Connection, Error, Result, CONFIG,
|
||||||
};
|
};
|
||||||
use activitypub::activity::{Accept, Follow as FollowAct, Undo};
|
use activitypub::activity::{Accept, Follow as FollowAct, Undo};
|
||||||
|
use activitystreams::{
|
||||||
|
activity::{Accept as Accept07, Follow as FollowAct07},
|
||||||
|
base::AnyBase,
|
||||||
|
iri_string::types::IriString,
|
||||||
|
prelude::*,
|
||||||
|
};
|
||||||
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl};
|
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl};
|
||||||
use plume_common::activity_pub::{
|
use plume_common::activity_pub::{
|
||||||
broadcast,
|
broadcast,
|
||||||
|
@ -310,6 +316,28 @@ mod tests {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn to_activity07() {
|
||||||
|
let conn = db();
|
||||||
|
conn.test_transaction::<_, Error, _>(|| {
|
||||||
|
let (follow, _following, _follower, _users) = prepare_activity(&conn);
|
||||||
|
let act = follow.to_activity07(&conn)?;
|
||||||
|
|
||||||
|
let expected = json!({
|
||||||
|
"actor": "https://plu.me/@/other/",
|
||||||
|
"cc": ["https://www.w3.org/ns/activitystreams#Public"],
|
||||||
|
"id": format!("https://plu.me/follows/{}", follow.id),
|
||||||
|
"object": "https://plu.me/@/user/",
|
||||||
|
"to": ["https://plu.me/@/user/"],
|
||||||
|
"type": "Follow"
|
||||||
|
});
|
||||||
|
|
||||||
|
assert_json_eq!(to_value(act)?, expected);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn build_accept() {
|
fn build_accept() {
|
||||||
let conn = db();
|
let conn = db();
|
||||||
|
|
Loading…
Reference in a new issue