Make test data follow blog test data change

This commit is contained in:
Kitaiti Makoto 2023-01-09 07:29:01 +09:00
parent f369fa9b25
commit 5bd084eff7
5 changed files with 36 additions and 36 deletions

View File

@ -463,13 +463,13 @@ mod tests {
assert_json_eq!(to_value(&act).unwrap(), json!({ assert_json_eq!(to_value(&act).unwrap(), json!({
"actor": "https://plu.me/@/admin/", "actor": "https://plu.me/@/admin/",
"cc": ["https://plu.me/@/admin/followers"], "cc": ["https://plu.me/@/admin/followers"],
"id": format!("https://plu.me/~/BlogName/testing/comment/{}/activity", original_comm.id), "id": format!("https://plu.me/~/Blog%20Name/testing/comment/{}/activity", original_comm.id),
"object": { "object": {
"attributedTo": "https://plu.me/@/admin/", "attributedTo": "https://plu.me/@/admin/",
"content": r###"<p dir="auto">My comment, mentioning to <a href="https://plu.me/@/user/" title="user">@user</a></p> "content": r###"<p dir="auto">My comment, mentioning to <a href="https://plu.me/@/user/" title="user">@user</a></p>
"###, "###,
"id": format!("https://plu.me/~/BlogName/testing/comment/{}", original_comm.id), "id": format!("https://plu.me/~/Blog%20Name/testing/comment/{}", original_comm.id),
"inReplyTo": "https://plu.me/~/BlogName/testing", "inReplyTo": "https://plu.me/~/Blog%20Name/testing",
"published": format_datetime(&original_comm.creation_date), "published": format_datetime(&original_comm.creation_date),
"summary": "My CW", "summary": "My CW",
"tag": [ "tag": [
@ -505,12 +505,12 @@ mod tests {
assert_json_eq!(to_value(&reply_act).unwrap(), json!({ assert_json_eq!(to_value(&reply_act).unwrap(), json!({
"actor": "https://plu.me/@/user/", "actor": "https://plu.me/@/user/",
"cc": ["https://plu.me/@/user/followers"], "cc": ["https://plu.me/@/user/followers"],
"id": format!("https://plu.me/~/BlogName/testing/comment/{}/activity", reply.id), "id": format!("https://plu.me/~/Blog%20Name/testing/comment/{}/activity", reply.id),
"object": { "object": {
"attributedTo": "https://plu.me/@/user/", "attributedTo": "https://plu.me/@/user/",
"content": "", "content": "",
"id": format!("https://plu.me/~/BlogName/testing/comment/{}", reply.id), "id": format!("https://plu.me/~/Blog%20Name/testing/comment/{}", reply.id),
"inReplyTo": format!("https://plu.me/~/BlogName/testing/comment/{}", original_comm.id), "inReplyTo": format!("https://plu.me/~/Blog%20Name/testing/comment/{}", original_comm.id),
"published": format_datetime(&reply.creation_date), "published": format_datetime(&reply.creation_date),
"summary": "", "summary": "",
"tag": [], "tag": [],
@ -554,8 +554,8 @@ mod tests {
"attributedTo": "https://plu.me/@/admin/", "attributedTo": "https://plu.me/@/admin/",
"content": r###"<p dir="auto">My comment, mentioning to <a href="https://plu.me/@/user/" title="user">@user</a></p> "content": r###"<p dir="auto">My comment, mentioning to <a href="https://plu.me/@/user/" title="user">@user</a></p>
"###, "###,
"id": format!("https://plu.me/~/BlogName/testing/comment/{}", comment.id), "id": format!("https://plu.me/~/Blog%20Name/testing/comment/{}", comment.id),
"inReplyTo": "https://plu.me/~/BlogName/testing", "inReplyTo": "https://plu.me/~/Blog%20Name/testing",
"published": format_datetime(&comment.creation_date), "published": format_datetime(&comment.creation_date),
"summary": "My CW", "summary": "My CW",
"tag": [ "tag": [
@ -584,9 +584,9 @@ mod tests {
let expected = json!({ let expected = json!({
"actor": "https://plu.me/@/admin/", "actor": "https://plu.me/@/admin/",
"id": format!("https://plu.me/~/BlogName/testing/comment/{}#delete", comment.id), "id": format!("https://plu.me/~/Blog%20Name/testing/comment/{}#delete", comment.id),
"object": { "object": {
"id": format!("https://plu.me/~/BlogName/testing/comment/{}", comment.id), "id": format!("https://plu.me/~/Blog%20Name/testing/comment/{}", comment.id),
"type": "Tombstone" "type": "Tombstone"
}, },
"to": ["https://www.w3.org/ns/activitystreams#Public"], "to": ["https://www.w3.org/ns/activitystreams#Public"],

View File

@ -268,7 +268,7 @@ pub(crate) mod tests {
"actor": users[0].ap_url, "actor": users[0].ap_url,
"object": { "object": {
"type": "Article", "type": "Article",
"id": "https://plu.me/~/BlogName/testing", "id": "https://plu.me/~/Blog%20Name/testing",
"attributedTo": [users[0].ap_url, blogs[0].ap_url], "attributedTo": [users[0].ap_url, blogs[0].ap_url],
"content": "Hello.", "content": "Hello.",
"name": "My Article", "name": "My Article",

View File

@ -205,8 +205,8 @@ mod tests {
let expected = json!({ let expected = json!({
"actor": "https://plu.me/@/admin/", "actor": "https://plu.me/@/admin/",
"cc": ["https://plu.me/@/admin/followers"], "cc": ["https://plu.me/@/admin/followers"],
"id": "https://plu.me/@/admin/like/https://plu.me/~/BlogName/testing", "id": "https://plu.me/@/admin/like/https://plu.me/~/Blog%20Name/testing",
"object": "https://plu.me/~/BlogName/testing", "object": "https://plu.me/~/Blog%20Name/testing",
"to": ["https://www.w3.org/ns/activitystreams#Public"], "to": ["https://www.w3.org/ns/activitystreams#Public"],
"type": "Like", "type": "Like",
}); });
@ -229,12 +229,12 @@ mod tests {
let expected = json!({ let expected = json!({
"actor": "https://plu.me/@/admin/", "actor": "https://plu.me/@/admin/",
"cc": ["https://plu.me/@/admin/followers"], "cc": ["https://plu.me/@/admin/followers"],
"id": "https://plu.me/@/admin/like/https://plu.me/~/BlogName/testing#delete", "id": "https://plu.me/@/admin/like/https://plu.me/~/Blog%20Name/testing#delete",
"object": { "object": {
"actor": "https://plu.me/@/admin/", "actor": "https://plu.me/@/admin/",
"cc": ["https://plu.me/@/admin/followers"], "cc": ["https://plu.me/@/admin/followers"],
"id": "https://plu.me/@/admin/like/https://plu.me/~/BlogName/testing", "id": "https://plu.me/@/admin/like/https://plu.me/~/Blog%20Name/testing",
"object": "https://plu.me/~/BlogName/testing", "object": "https://plu.me/~/Blog%20Name/testing",
"to": ["https://www.w3.org/ns/activitystreams#Public"], "to": ["https://www.w3.org/ns/activitystreams#Public"],
"type": "Like", "type": "Like",
}, },

View File

@ -1109,10 +1109,10 @@ mod tests {
let act = post.to_activity(&conn)?; let act = post.to_activity(&conn)?;
let expected = json!({ let expected = json!({
"attributedTo": ["https://plu.me/@/admin/", "https://plu.me/~/BlogName/"], "attributedTo": ["https://plu.me/@/admin/", "https://plu.me/~/Blog%20Name/"],
"cc": [], "cc": [],
"content": "Hello", "content": "Hello",
"id": "https://plu.me/~/BlogName/testing", "id": "https://plu.me/~/Blog%20Name/testing",
"license": "WTFPL", "license": "WTFPL",
"name": "Testing", "name": "Testing",
"published": format_datetime(&post.creation_date), "published": format_datetime(&post.creation_date),
@ -1130,7 +1130,7 @@ mod tests {
], ],
"to": ["https://www.w3.org/ns/activitystreams#Public"], "to": ["https://www.w3.org/ns/activitystreams#Public"],
"type": "Article", "type": "Article",
"url": "https://plu.me/~/BlogName/testing" "url": "https://plu.me/~/Blog%20Name/testing"
}); });
assert_json_eq!(to_value(act)?, expected); assert_json_eq!(to_value(act)?, expected);
@ -1149,12 +1149,12 @@ mod tests {
let expected = json!({ let expected = json!({
"actor": "https://plu.me/@/admin/", "actor": "https://plu.me/@/admin/",
"cc": [], "cc": [],
"id": "https://plu.me/~/BlogName/testing/activity", "id": "https://plu.me/~/Blog%20Name/testing/activity",
"object": { "object": {
"attributedTo": ["https://plu.me/@/admin/", "https://plu.me/~/BlogName/"], "attributedTo": ["https://plu.me/@/admin/", "https://plu.me/~/Blog%20Name/"],
"cc": [], "cc": [],
"content": "Hello", "content": "Hello",
"id": "https://plu.me/~/BlogName/testing", "id": "https://plu.me/~/Blog%20Name/testing",
"license": "WTFPL", "license": "WTFPL",
"name": "Testing", "name": "Testing",
"published": format_datetime(&post.creation_date), "published": format_datetime(&post.creation_date),
@ -1172,7 +1172,7 @@ mod tests {
], ],
"to": ["https://www.w3.org/ns/activitystreams#Public"], "to": ["https://www.w3.org/ns/activitystreams#Public"],
"type": "Article", "type": "Article",
"url": "https://plu.me/~/BlogName/testing" "url": "https://plu.me/~/Blog%20Name/testing"
}, },
"to": ["https://www.w3.org/ns/activitystreams#Public"], "to": ["https://www.w3.org/ns/activitystreams#Public"],
"type": "Create" "type": "Create"
@ -1194,12 +1194,12 @@ mod tests {
let expected = json!({ let expected = json!({
"actor": "https://plu.me/@/admin/", "actor": "https://plu.me/@/admin/",
"cc": [], "cc": [],
"id": "https://plu.me/~/BlogName/testing/update-", "id": "https://plu.me/~/Blog%20Name/testing/update-",
"object": { "object": {
"attributedTo": ["https://plu.me/@/admin/", "https://plu.me/~/BlogName/"], "attributedTo": ["https://plu.me/@/admin/", "https://plu.me/~/Blog%20Name/"],
"cc": [], "cc": [],
"content": "Hello", "content": "Hello",
"id": "https://plu.me/~/BlogName/testing", "id": "https://plu.me/~/Blog%20Name/testing",
"license": "WTFPL", "license": "WTFPL",
"name": "Testing", "name": "Testing",
"published": format_datetime(&post.creation_date), "published": format_datetime(&post.creation_date),
@ -1217,7 +1217,7 @@ mod tests {
], ],
"to": ["https://www.w3.org/ns/activitystreams#Public"], "to": ["https://www.w3.org/ns/activitystreams#Public"],
"type": "Article", "type": "Article",
"url": "https://plu.me/~/BlogName/testing" "url": "https://plu.me/~/Blog%20Name/testing"
}, },
"to": ["https://www.w3.org/ns/activitystreams#Public"], "to": ["https://www.w3.org/ns/activitystreams#Public"],
"type": "Update" "type": "Update"
@ -1226,10 +1226,10 @@ mod tests {
let id = actual["id"].to_string(); let id = actual["id"].to_string();
let (id_pre, id_post) = id.rsplit_once('-').unwrap(); let (id_pre, id_post) = id.rsplit_once('-').unwrap();
assert_eq!(post.ap_url, "https://plu.me/~/BlogName/testing"); assert_eq!(post.ap_url, "https://plu.me/~/Blog%20Name/testing");
assert_eq!( assert_eq!(
id_pre, id_pre,
to_value("\"https://plu.me/~/BlogName/testing/update") to_value("\"https://plu.me/~/Blog%20Name/testing/update")
.unwrap() .unwrap()
.as_str() .as_str()
.unwrap() .unwrap()
@ -1259,9 +1259,9 @@ mod tests {
let expected = json!({ let expected = json!({
"actor": "https://plu.me/@/admin/", "actor": "https://plu.me/@/admin/",
"id": "https://plu.me/~/BlogName/testing#delete", "id": "https://plu.me/~/Blog%20Name/testing#delete",
"object": { "object": {
"id": "https://plu.me/~/BlogName/testing", "id": "https://plu.me/~/Blog%20Name/testing",
"type": "Tombstone" "type": "Tombstone"
}, },
"to": [ "to": [

View File

@ -235,8 +235,8 @@ mod test {
let expected = json!({ let expected = json!({
"actor": "https://plu.me/@/admin/", "actor": "https://plu.me/@/admin/",
"cc": ["https://plu.me/@/admin/followers"], "cc": ["https://plu.me/@/admin/followers"],
"id": "https://plu.me/@/admin/reshare/https://plu.me/~/BlogName/testing", "id": "https://plu.me/@/admin/reshare/https://plu.me/~/Blog%20Name/testing",
"object": "https://plu.me/~/BlogName/testing", "object": "https://plu.me/~/Blog%20Name/testing",
"to": ["https://www.w3.org/ns/activitystreams#Public"], "to": ["https://www.w3.org/ns/activitystreams#Public"],
"type": "Announce", "type": "Announce",
}); });
@ -259,12 +259,12 @@ mod test {
let expected = json!({ let expected = json!({
"actor": "https://plu.me/@/admin/", "actor": "https://plu.me/@/admin/",
"cc": ["https://plu.me/@/admin/followers"], "cc": ["https://plu.me/@/admin/followers"],
"id": "https://plu.me/@/admin/reshare/https://plu.me/~/BlogName/testing#delete", "id": "https://plu.me/@/admin/reshare/https://plu.me/~/Blog%20Name/testing#delete",
"object": { "object": {
"actor": "https://plu.me/@/admin/", "actor": "https://plu.me/@/admin/",
"cc": ["https://plu.me/@/admin/followers"], "cc": ["https://plu.me/@/admin/followers"],
"id": "https://plu.me/@/admin/reshare/https://plu.me/~/BlogName/testing", "id": "https://plu.me/@/admin/reshare/https://plu.me/~/Blog%20Name/testing",
"object": "https://plu.me/~/BlogName/testing", "object": "https://plu.me/~/Blog%20Name/testing",
"to": ["https://www.w3.org/ns/activitystreams#Public"], "to": ["https://www.w3.org/ns/activitystreams#Public"],
"type": "Announce" "type": "Announce"
}, },