mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-23 03:51:00 +00:00
Add test for Post::create_activity07()
This commit is contained in:
parent
680d321a2e
commit
871618f45d
1 changed files with 45 additions and 0 deletions
|
@ -1276,6 +1276,51 @@ mod tests {
|
|||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn create_activity07() {
|
||||
let conn = db();
|
||||
conn.test_transaction::<_, Error, _>(|| {
|
||||
let (post, _mention, _posts, _users, _blogs) = prepare_activity(&conn);
|
||||
let act = post.create_activity07(&conn)?;
|
||||
|
||||
let expected = json!({
|
||||
"actor": "https://plu.me/@/admin/",
|
||||
"cc": [],
|
||||
"id": "https://plu.me/~/BlogName/testing/activity",
|
||||
"object": {
|
||||
"attributedTo": ["https://plu.me/@/admin/", "https://plu.me/~/BlogName/"],
|
||||
"cc": [],
|
||||
"content": "Hello",
|
||||
"id": "https://plu.me/~/BlogName/testing",
|
||||
"license": "WTFPL",
|
||||
"name": "Testing",
|
||||
"published": format_datetime(&post.creation_date),
|
||||
"source": {
|
||||
"content": "",
|
||||
"mediaType": "text/markdown"
|
||||
},
|
||||
"summary": "",
|
||||
"tag": [
|
||||
{
|
||||
"href": "https://plu.me/@/user/",
|
||||
"name": "@user",
|
||||
"type": "Mention"
|
||||
}
|
||||
],
|
||||
"to": ["https://www.w3.org/ns/activitystreams#Public"],
|
||||
"type": "Article",
|
||||
"url": "https://plu.me/~/BlogName/testing"
|
||||
},
|
||||
"to": ["https://www.w3.org/ns/activitystreams#Public"],
|
||||
"type": "Create"
|
||||
});
|
||||
|
||||
assert_json_eq!(to_value(act)?, expected);
|
||||
|
||||
Ok(())
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn update_activity() {
|
||||
let conn = db();
|
||||
|
|
Loading…
Reference in a new issue