Fix integration tests (except one)
This commit is contained in:
parent
418eb8025c
commit
7bc9434596
1 changed files with 14 additions and 5 deletions
|
@ -1,5 +1,7 @@
|
||||||
extern crate lemmy_server;
|
extern crate lemmy_server;
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
extern crate diesel_migrations;
|
||||||
use activitystreams::{
|
use activitystreams::{
|
||||||
activity::{
|
activity::{
|
||||||
kind::{CreateType, FollowType},
|
kind::{CreateType, FollowType},
|
||||||
|
@ -28,11 +30,12 @@ use lemmy_apub::{
|
||||||
user_inbox::user_inbox,
|
user_inbox::user_inbox,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use lemmy_db_queries::{Crud, ListingType, SortType};
|
use lemmy_db_queries::{get_database_url_from_env, Crud, ListingType, SortType};
|
||||||
use lemmy_db_schema::source::{
|
use lemmy_db_schema::source::{
|
||||||
community::{Community, CommunityForm},
|
community::{Community, CommunityForm},
|
||||||
user::{UserForm, User_},
|
user::{UserForm, User_},
|
||||||
};
|
};
|
||||||
|
use lemmy_server::code_migrations::run_advanced_migrations;
|
||||||
use lemmy_utils::{
|
use lemmy_utils::{
|
||||||
apub::generate_actor_keypair,
|
apub::generate_actor_keypair,
|
||||||
rate_limit::{rate_limiter::RateLimiter, RateLimit},
|
rate_limit::{rate_limiter::RateLimiter, RateLimit},
|
||||||
|
@ -41,18 +44,25 @@ use lemmy_utils::{
|
||||||
use lemmy_websocket::{chat_server::ChatServer, LemmyContext};
|
use lemmy_websocket::{chat_server::ChatServer, LemmyContext};
|
||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::sync::Arc;
|
use std::{ops::Deref, sync::Arc};
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
|
embed_migrations!();
|
||||||
|
|
||||||
fn create_context() -> LemmyContext {
|
fn create_context() -> LemmyContext {
|
||||||
let settings = Settings::get();
|
let settings = Settings::get();
|
||||||
let db_url = settings.get_database_url();
|
let db_url = match get_database_url_from_env() {
|
||||||
|
Ok(url) => url,
|
||||||
|
Err(_) => settings.get_database_url(),
|
||||||
|
};
|
||||||
let manager = ConnectionManager::<PgConnection>::new(&db_url);
|
let manager = ConnectionManager::<PgConnection>::new(&db_url);
|
||||||
let pool = Pool::builder()
|
let pool = Pool::builder()
|
||||||
.max_size(settings.database.pool_size)
|
.max_size(settings.database.pool_size)
|
||||||
.build(manager)
|
.build(manager)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
embedded_migrations::run(&pool.get().unwrap()).unwrap();
|
||||||
|
run_advanced_migrations(pool.get().unwrap().deref()).unwrap();
|
||||||
let rate_limiter = RateLimit {
|
let rate_limiter = RateLimit {
|
||||||
rate_limiter: Arc::new(Mutex::new(RateLimiter::default())),
|
rate_limiter: Arc::new(Mutex::new(RateLimiter::default())),
|
||||||
};
|
};
|
||||||
|
@ -154,6 +164,7 @@ fn create_http_request() -> HttpRequest {
|
||||||
.to_http_request()
|
.to_http_request()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: this fails with a stack overflow for some reason
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
#[ignore]
|
#[ignore]
|
||||||
async fn test_shared_inbox_expired_signature() {
|
async fn test_shared_inbox_expired_signature() {
|
||||||
|
@ -172,7 +183,6 @@ async fn test_shared_inbox_expired_signature() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
#[ignore]
|
|
||||||
async fn test_user_inbox_expired_signature() {
|
async fn test_user_inbox_expired_signature() {
|
||||||
let request = create_http_request();
|
let request = create_http_request();
|
||||||
let context = create_context();
|
let context = create_context();
|
||||||
|
@ -192,7 +202,6 @@ async fn test_user_inbox_expired_signature() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
#[ignore]
|
|
||||||
async fn test_community_inbox_expired_signature() {
|
async fn test_community_inbox_expired_signature() {
|
||||||
let context = create_context();
|
let context = create_context();
|
||||||
let connection = &context.pool().get().unwrap();
|
let connection = &context.pool().get().unwrap();
|
||||||
|
|
Loading…
Reference in a new issue