From d6046982e05a254b9304cd34352b4bc130c70250 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 13 Aug 2019 20:15:52 -0700 Subject: [PATCH] Fixing nsfw unit tests --- server/src/apub.rs | 3 ++- server/src/db/comment.rs | 9 ++++++--- server/src/db/comment_view.rs | 9 ++++++--- server/src/db/community.rs | 3 ++- server/src/db/moderator.rs | 12 ++++++++---- server/src/db/post.rs | 6 ++++-- server/src/db/post_view.rs | 11 +++++++++-- 7 files changed, 37 insertions(+), 16 deletions(-) diff --git a/server/src/apub.rs b/server/src/apub.rs index 23735e63..9de32401 100644 --- a/server/src/apub.rs +++ b/server/src/apub.rs @@ -46,7 +46,8 @@ mod tests { published: naive_now(), admin: false, banned: false, - updated: None + updated: None, + show_nsfw: false, }; let person = expected_user.person(); diff --git a/server/src/db/comment.rs b/server/src/db/comment.rs index d125124c..ce0b5a63 100644 --- a/server/src/db/comment.rs +++ b/server/src/db/comment.rs @@ -170,7 +170,8 @@ mod tests { email: None, admin: false, banned: false, - updated: None + updated: None, + show_nsfw: false, }; let inserted_user = User_::create(&conn, &new_user).unwrap(); @@ -183,7 +184,8 @@ mod tests { creator_id: inserted_user.id, removed: None, deleted: None, - updated: None + updated: None, + nsfw: false, }; let inserted_community = Community::create(&conn, &new_community).unwrap(); @@ -197,7 +199,8 @@ mod tests { removed: None, deleted: None, locked: None, - updated: None + updated: None, + nsfw: false, }; let inserted_post = Post::create(&conn, &new_post).unwrap(); diff --git a/server/src/db/comment_view.rs b/server/src/db/comment_view.rs index 53517db9..8a6545ba 100644 --- a/server/src/db/comment_view.rs +++ b/server/src/db/comment_view.rs @@ -261,7 +261,8 @@ mod tests { email: None, admin: false, banned: false, - updated: None + updated: None, + show_nsfw: false, }; let inserted_user = User_::create(&conn, &new_user).unwrap(); @@ -274,7 +275,8 @@ mod tests { creator_id: inserted_user.id, removed: None, deleted: None, - updated: None + updated: None, + nsfw: false, }; let inserted_community = Community::create(&conn, &new_community).unwrap(); @@ -288,7 +290,8 @@ mod tests { removed: None, deleted: None, locked: None, - updated: None + updated: None, + nsfw: false, }; let inserted_post = Post::create(&conn, &new_post).unwrap(); diff --git a/server/src/db/community.rs b/server/src/db/community.rs index aa28c9c7..dd6ea94b 100644 --- a/server/src/db/community.rs +++ b/server/src/db/community.rs @@ -231,7 +231,8 @@ mod tests { email: None, admin: false, banned: false, - updated: None + updated: None, + show_nsfw: false, }; let inserted_user = User_::create(&conn, &new_user).unwrap(); diff --git a/server/src/db/moderator.rs b/server/src/db/moderator.rs index 56cf2f47..fec46aa1 100644 --- a/server/src/db/moderator.rs +++ b/server/src/db/moderator.rs @@ -412,7 +412,8 @@ mod tests { email: None, admin: false, banned: false, - updated: None + updated: None, + show_nsfw: false, }; let inserted_mod = User_::create(&conn, &new_mod).unwrap(); @@ -425,7 +426,8 @@ mod tests { email: None, admin: false, banned: false, - updated: None + updated: None, + show_nsfw: false, }; let inserted_user = User_::create(&conn, &new_user).unwrap(); @@ -438,7 +440,8 @@ mod tests { creator_id: inserted_user.id, removed: None, deleted: None, - updated: None + updated: None, + nsfw: false, }; let inserted_community = Community::create(&conn, &new_community).unwrap(); @@ -452,7 +455,8 @@ mod tests { removed: None, deleted: None, locked: None, - updated: None + updated: None, + nsfw: false, }; let inserted_post = Post::create(&conn, &new_post).unwrap(); diff --git a/server/src/db/post.rs b/server/src/db/post.rs index 6a8bf26d..12ea1081 100644 --- a/server/src/db/post.rs +++ b/server/src/db/post.rs @@ -185,7 +185,8 @@ mod tests { email: None, admin: false, banned: false, - updated: None + updated: None, + show_nsfw: false, }; let inserted_user = User_::create(&conn, &new_user).unwrap(); @@ -198,7 +199,8 @@ mod tests { creator_id: inserted_user.id, removed: None, deleted: None, - updated: None + updated: None, + nsfw: false, }; let inserted_community = Community::create(&conn, &new_community).unwrap(); diff --git a/server/src/db/post_view.rs b/server/src/db/post_view.rs index 73686266..c7e6eea3 100644 --- a/server/src/db/post_view.rs +++ b/server/src/db/post_view.rs @@ -208,6 +208,7 @@ mod tests { updated: None, admin: false, banned: false, + show_nsfw: false, }; let inserted_user = User_::create(&conn, &new_user).unwrap(); @@ -220,7 +221,8 @@ mod tests { category_id: 1, removed: None, deleted: None, - updated: None + updated: None, + nsfw: false, }; let inserted_community = Community::create(&conn, &new_community).unwrap(); @@ -234,7 +236,8 @@ mod tests { removed: None, deleted: None, locked: None, - updated: None + updated: None, + nsfw: false, }; let inserted_post = Post::create(&conn, &new_post).unwrap(); @@ -289,6 +292,7 @@ mod tests { subscribed: None, read: None, saved: None, + nsfw: false, }; let expected_post_listing_with_user = PostView { @@ -318,6 +322,7 @@ mod tests { subscribed: None, read: None, saved: None, + nsfw: false, }; @@ -327,6 +332,7 @@ mod tests { None, None, Some(inserted_user.id), + false, false, false, None, @@ -338,6 +344,7 @@ mod tests { None, None, None, + false, false, false, None, -- 2.44.1