Fixing some tests
This commit is contained in:
parent
9cb4dad4b4
commit
1a4c8c08ee
4 changed files with 28 additions and 4 deletions
|
@ -77,7 +77,11 @@ mod tests {
|
||||||
source::password_reset_request::PasswordResetRequest_,
|
source::password_reset_request::PasswordResetRequest_,
|
||||||
Crud,
|
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;
|
use serial_test::serial;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -106,15 +110,32 @@ mod tests {
|
||||||
|
|
||||||
let inserted_person = Person::create(&conn, &new_person).unwrap();
|
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 = "nope";
|
||||||
let token_encrypted_ = "ca3704aa0b06f5954c79ee837faa152d84d6b2d42838f0637a15eda8337dbdce";
|
let token_encrypted_ = "ca3704aa0b06f5954c79ee837faa152d84d6b2d42838f0637a15eda8337dbdce";
|
||||||
|
|
||||||
let inserted_password_reset_request =
|
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 {
|
let expected_password_reset_request = PasswordResetRequest {
|
||||||
id: inserted_password_reset_request.id,
|
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(),
|
token_encrypted: token_encrypted_.to_string(),
|
||||||
published: inserted_password_reset_request.published,
|
published: inserted_password_reset_request.published,
|
||||||
};
|
};
|
||||||
|
|
|
@ -449,7 +449,7 @@ mod tests {
|
||||||
let conn = establish_unpooled_connection();
|
let conn = establish_unpooled_connection();
|
||||||
|
|
||||||
let new_person = PersonForm {
|
let new_person = PersonForm {
|
||||||
name: "thommy".into(),
|
name: "timmy".into(),
|
||||||
preferred_username: None,
|
preferred_username: None,
|
||||||
avatar: None,
|
avatar: None,
|
||||||
banner: None,
|
banner: None,
|
||||||
|
|
3
scripts/clear_db.sh
Executable file
3
scripts/clear_db.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
psql -U lemmy -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public; DROP SCHEMA utils CASCADE;"
|
Loading…
Reference in a new issue