Fixing some tests

This commit is contained in:
Dessalines 2021-03-11 11:41:04 -05:00
parent 9cb4dad4b4
commit 1a4c8c08ee
4 changed files with 28 additions and 4 deletions

View file

@ -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,
};

View file

@ -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,

3
scripts/clear_db.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
psql -U lemmy -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public; DROP SCHEMA utils CASCADE;"