From: Dessalines Date: Thu, 11 Mar 2021 16:41:04 +0000 (-0500) Subject: Fixing some tests X-Git-Url: http://these/git/%7Biframely.url%7D?a=commitdiff_plain;h=1a4c8c08ee05fa992342078c278737c24d5bbcc1;p=lemmy.git Fixing some tests --- diff --git a/crates/db_queries/src/source/password_reset_request.rs b/crates/db_queries/src/source/password_reset_request.rs index 96fd0647..dd00e6ff 100644 --- a/crates/db_queries/src/source/password_reset_request.rs +++ b/crates/db_queries/src/source/password_reset_request.rs @@ -77,7 +77,11 @@ mod tests { source::password_reset_request::PasswordResetRequest_, Crud, }; - use lemmy_db_schema::source::{password_reset_request::PasswordResetRequest, person::*}; + use lemmy_db_schema::source::{ + local_user::{LocalUser, LocalUserForm}, + password_reset_request::PasswordResetRequest, + person::*, + }; use serial_test::serial; #[test] @@ -106,15 +110,32 @@ mod tests { let inserted_person = Person::create(&conn, &new_person).unwrap(); + let new_local_user = LocalUserForm { + person_id: inserted_person.id, + password_encrypted: "pass".to_string(), + email: None, + matrix_user_id: None, + admin: None, + show_nsfw: None, + theme: None, + default_sort_type: None, + default_listing_type: None, + lang: None, + show_avatars: None, + send_notifications_to_email: None, + }; + + let inserted_local_user = LocalUser::create(&conn, &new_local_user).unwrap(); + let token = "nope"; let token_encrypted_ = "ca3704aa0b06f5954c79ee837faa152d84d6b2d42838f0637a15eda8337dbdce"; let inserted_password_reset_request = - PasswordResetRequest::create_token(&conn, inserted_person.id, token).unwrap(); + PasswordResetRequest::create_token(&conn, inserted_local_user.id, token).unwrap(); let expected_password_reset_request = PasswordResetRequest { id: inserted_password_reset_request.id, - local_user_id: inserted_person.id, + local_user_id: inserted_local_user.id, token_encrypted: token_encrypted_.to_string(), published: inserted_password_reset_request.published, }; diff --git a/crates/db_views/src/comment_view.rs b/crates/db_views/src/comment_view.rs index 49bad6c0..79c42003 100644 --- a/crates/db_views/src/comment_view.rs +++ b/crates/db_views/src/comment_view.rs @@ -449,7 +449,7 @@ mod tests { let conn = establish_unpooled_connection(); let new_person = PersonForm { - name: "thommy".into(), + name: "timmy".into(), preferred_username: None, avatar: None, banner: None, diff --git a/scripts/clear_db.sh b/scripts/clear_db.sh new file mode 100755 index 00000000..b62490e1 --- /dev/null +++ b/scripts/clear_db.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +psql -U lemmy -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public; DROP SCHEMA utils CASCADE;" diff --git a/restore_db.sh b/scripts/restore_db.sh similarity index 100% rename from restore_db.sh rename to scripts/restore_db.sh