mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-01 16:51:21 +00:00
fix unit tests
This commit is contained in:
parent
2c9000f664
commit
0916c48054
16 changed files with 46 additions and 2 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1751,6 +1751,7 @@ dependencies = [
|
|||
"http",
|
||||
"http-signature-normalization-actix",
|
||||
"itertools",
|
||||
"language-tags 0.3.0",
|
||||
"lazy_static",
|
||||
"lemmy_api_common",
|
||||
"lemmy_apub",
|
||||
|
|
|
@ -48,3 +48,4 @@ anyhow = "1.0.38"
|
|||
thiserror = "1.0.23"
|
||||
background-jobs = "0.8.0"
|
||||
reqwest = { version = "0.10.10", features = ["json"] }
|
||||
language-tags = "0.3.0"
|
||||
|
|
|
@ -185,6 +185,7 @@ mod tests {
|
|||
person::{Person, PersonForm},
|
||||
};
|
||||
use lemmy_utils::claims::Claims;
|
||||
use language_tags::LanguageTag;
|
||||
|
||||
#[test]
|
||||
fn test_should_not_validate_user_token_after_password_change() {
|
||||
|
@ -200,6 +201,7 @@ mod tests {
|
|||
let local_user_form = LocalUserForm {
|
||||
person_id: inserted_person.id,
|
||||
password_encrypted: "123456".to_string(),
|
||||
discussion_languages: Some(vec![LanguageTag::parse("en").unwrap().into()]),
|
||||
..LocalUserForm::default()
|
||||
};
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ mod tests {
|
|||
post::{Post, PostForm},
|
||||
};
|
||||
use serial_test::serial;
|
||||
use language_tags::LanguageTag;
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
|
@ -68,6 +69,7 @@ mod tests {
|
|||
name: "A test post".into(),
|
||||
creator_id: inserted_person.id,
|
||||
community_id: inserted_community.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..PostForm::default()
|
||||
};
|
||||
|
||||
|
@ -77,6 +79,7 @@ mod tests {
|
|||
content: "A test comment".into(),
|
||||
creator_id: inserted_person.id,
|
||||
post_id: inserted_post.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..CommentForm::default()
|
||||
};
|
||||
|
||||
|
@ -87,6 +90,7 @@ mod tests {
|
|||
creator_id: inserted_person.id,
|
||||
post_id: inserted_post.id,
|
||||
parent_id: Some(inserted_comment.id),
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..CommentForm::default()
|
||||
};
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ mod tests {
|
|||
post::{Post, PostForm},
|
||||
};
|
||||
use serial_test::serial;
|
||||
use language_tags::LanguageTag;
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
|
@ -104,6 +105,7 @@ mod tests {
|
|||
name: "A test post".into(),
|
||||
creator_id: inserted_person.id,
|
||||
community_id: inserted_community.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..PostForm::default()
|
||||
};
|
||||
|
||||
|
@ -113,6 +115,7 @@ mod tests {
|
|||
content: "A test comment".into(),
|
||||
creator_id: inserted_person.id,
|
||||
post_id: inserted_post.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..CommentForm::default()
|
||||
};
|
||||
|
||||
|
@ -123,6 +126,7 @@ mod tests {
|
|||
creator_id: inserted_person.id,
|
||||
post_id: inserted_post.id,
|
||||
parent_id: Some(inserted_comment.id),
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..CommentForm::default()
|
||||
};
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ mod tests {
|
|||
post::{Post, PostForm, PostLike, PostLikeForm},
|
||||
};
|
||||
use serial_test::serial;
|
||||
use language_tags::LanguageTag;
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
|
@ -68,6 +69,7 @@ mod tests {
|
|||
name: "A test post".into(),
|
||||
creator_id: inserted_person.id,
|
||||
community_id: inserted_community.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..PostForm::default()
|
||||
};
|
||||
|
||||
|
@ -85,6 +87,7 @@ mod tests {
|
|||
content: "A test comment".into(),
|
||||
creator_id: inserted_person.id,
|
||||
post_id: inserted_post.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..CommentForm::default()
|
||||
};
|
||||
|
||||
|
@ -104,6 +107,7 @@ mod tests {
|
|||
creator_id: inserted_person.id,
|
||||
post_id: inserted_post.id,
|
||||
parent_id: Some(inserted_comment.id),
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..CommentForm::default()
|
||||
};
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ mod tests {
|
|||
post::{Post, PostForm, PostLike, PostLikeForm},
|
||||
};
|
||||
use serial_test::serial;
|
||||
use language_tags::LanguageTag;
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
|
@ -72,6 +73,7 @@ mod tests {
|
|||
name: "A test post".into(),
|
||||
creator_id: inserted_person.id,
|
||||
community_id: inserted_community.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..PostForm::default()
|
||||
};
|
||||
|
||||
|
@ -81,6 +83,7 @@ mod tests {
|
|||
content: "A test comment".into(),
|
||||
creator_id: inserted_person.id,
|
||||
post_id: inserted_post.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..CommentForm::default()
|
||||
};
|
||||
|
||||
|
@ -91,6 +94,7 @@ mod tests {
|
|||
creator_id: inserted_person.id,
|
||||
post_id: inserted_post.id,
|
||||
parent_id: Some(inserted_comment.id),
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..CommentForm::default()
|
||||
};
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ mod tests {
|
|||
site::{Site, SiteForm},
|
||||
};
|
||||
use serial_test::serial;
|
||||
use language_tags::LanguageTag;
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
|
@ -74,6 +75,7 @@ mod tests {
|
|||
name: "A test post".into(),
|
||||
creator_id: inserted_person.id,
|
||||
community_id: inserted_community.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..PostForm::default()
|
||||
};
|
||||
|
||||
|
@ -85,6 +87,7 @@ mod tests {
|
|||
content: "A test comment".into(),
|
||||
creator_id: inserted_person.id,
|
||||
post_id: inserted_post.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..CommentForm::default()
|
||||
};
|
||||
|
||||
|
@ -96,6 +99,7 @@ mod tests {
|
|||
creator_id: inserted_person.id,
|
||||
post_id: inserted_post.id,
|
||||
parent_id: Some(inserted_comment.id),
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..CommentForm::default()
|
||||
};
|
||||
|
||||
|
|
|
@ -238,6 +238,7 @@ mod tests {
|
|||
post::*,
|
||||
};
|
||||
use serial_test::serial;
|
||||
use language_tags::LanguageTag;
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
|
@ -263,6 +264,7 @@ mod tests {
|
|||
name: "A test post".into(),
|
||||
creator_id: inserted_person.id,
|
||||
community_id: inserted_community.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..PostForm::default()
|
||||
};
|
||||
|
||||
|
@ -272,6 +274,7 @@ mod tests {
|
|||
content: "A test comment".into(),
|
||||
creator_id: inserted_person.id,
|
||||
post_id: inserted_post.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..CommentForm::default()
|
||||
};
|
||||
|
||||
|
@ -290,7 +293,7 @@ mod tests {
|
|||
updated: None,
|
||||
ap_id: inserted_comment.ap_id.to_owned(),
|
||||
local: true,
|
||||
language: None,
|
||||
language: LanguageTag::parse("en").unwrap().into(),
|
||||
};
|
||||
|
||||
let child_comment_form = CommentForm {
|
||||
|
@ -298,6 +301,7 @@ mod tests {
|
|||
creator_id: inserted_person.id,
|
||||
post_id: inserted_post.id,
|
||||
parent_id: Some(inserted_comment.id),
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..CommentForm::default()
|
||||
};
|
||||
|
||||
|
|
|
@ -200,6 +200,7 @@ mod tests {
|
|||
use crate::{establish_unpooled_connection, Crud};
|
||||
use lemmy_db_schema::source::{comment::*, community::*, moderator::*, person::*, post::*};
|
||||
use serial_test::serial;
|
||||
use language_tags::LanguageTag;
|
||||
|
||||
// use Crud;
|
||||
#[test]
|
||||
|
@ -233,6 +234,7 @@ mod tests {
|
|||
name: "A test post thweep".into(),
|
||||
creator_id: inserted_person.id,
|
||||
community_id: inserted_community.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..PostForm::default()
|
||||
};
|
||||
|
||||
|
@ -242,6 +244,7 @@ mod tests {
|
|||
content: "A test comment".into(),
|
||||
creator_id: inserted_person.id,
|
||||
post_id: inserted_post.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..CommentForm::default()
|
||||
};
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ mod tests {
|
|||
person::*,
|
||||
};
|
||||
use serial_test::serial;
|
||||
use language_tags::LanguageTag;
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
|
@ -103,6 +104,7 @@ mod tests {
|
|||
let new_local_user = LocalUserForm {
|
||||
person_id: inserted_person.id,
|
||||
password_encrypted: "pass".to_string(),
|
||||
discussion_languages: Some(vec![LanguageTag::parse("en").unwrap().into()]),
|
||||
..LocalUserForm::default()
|
||||
};
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ mod tests {
|
|||
post::*,
|
||||
};
|
||||
use serial_test::serial;
|
||||
use language_tags::LanguageTag;
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
|
@ -114,6 +115,7 @@ mod tests {
|
|||
name: "A test post".into(),
|
||||
creator_id: inserted_person.id,
|
||||
community_id: inserted_community.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..PostForm::default()
|
||||
};
|
||||
|
||||
|
@ -123,6 +125,7 @@ mod tests {
|
|||
content: "A test comment".into(),
|
||||
creator_id: inserted_person.id,
|
||||
post_id: inserted_post.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..CommentForm::default()
|
||||
};
|
||||
|
||||
|
|
|
@ -265,6 +265,7 @@ mod tests {
|
|||
person::*,
|
||||
};
|
||||
use serial_test::serial;
|
||||
use language_tags::LanguageTag;
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
|
@ -290,6 +291,7 @@ mod tests {
|
|||
name: "A test post".into(),
|
||||
creator_id: inserted_person.id,
|
||||
community_id: inserted_community.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..PostForm::default()
|
||||
};
|
||||
|
||||
|
@ -315,7 +317,7 @@ mod tests {
|
|||
thumbnail_url: None,
|
||||
ap_id: inserted_post.ap_id.to_owned(),
|
||||
local: true,
|
||||
language: None,
|
||||
language: LanguageTag::parse("en").unwrap().into(),
|
||||
};
|
||||
|
||||
// Post Like
|
||||
|
|
|
@ -142,6 +142,7 @@ mod tests {
|
|||
use crate::{establish_unpooled_connection, source::private_message::PrivateMessage_, Crud};
|
||||
use lemmy_db_schema::source::{person::*, private_message::*};
|
||||
use serial_test::serial;
|
||||
use language_tags::LanguageTag;
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
|
@ -166,6 +167,7 @@ mod tests {
|
|||
content: "A test private message".into(),
|
||||
creator_id: inserted_creator.id,
|
||||
recipient_id: inserted_recipient.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..PrivateMessageForm::default()
|
||||
};
|
||||
|
||||
|
@ -182,6 +184,7 @@ mod tests {
|
|||
published: inserted_private_message.published,
|
||||
ap_id: inserted_private_message.ap_id.to_owned(),
|
||||
local: true,
|
||||
language: LanguageTag::parse("en").unwrap().into(),
|
||||
};
|
||||
|
||||
let read_private_message = PrivateMessage::read(&conn, inserted_private_message.id).unwrap();
|
||||
|
|
|
@ -472,6 +472,7 @@ mod tests {
|
|||
name: "A test post 2".into(),
|
||||
creator_id: inserted_person.id,
|
||||
community_id: inserted_community.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..PostForm::default()
|
||||
};
|
||||
|
||||
|
@ -481,6 +482,7 @@ mod tests {
|
|||
content: "A test comment 32".into(),
|
||||
creator_id: inserted_person.id,
|
||||
post_id: inserted_post.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..CommentForm::default()
|
||||
};
|
||||
|
||||
|
|
|
@ -484,6 +484,7 @@ mod tests {
|
|||
name: post_name.to_owned(),
|
||||
creator_id: inserted_person.id,
|
||||
community_id: inserted_community.id,
|
||||
language: Some(LanguageTag::parse("en").unwrap().into()),
|
||||
..PostForm::default()
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue