Fix integration tests (except one)

This commit is contained in:
Felix Ableitner 2021-01-04 18:12:37 +01:00
parent 418eb8025c
commit 7bc9434596

View File

@ -1,5 +1,7 @@
extern crate lemmy_server;
#[macro_use]
extern crate diesel_migrations;
use activitystreams::{
activity::{
kind::{CreateType, FollowType},
@ -28,11 +30,12 @@ use lemmy_apub::{
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::{
community::{Community, CommunityForm},
user::{UserForm, User_},
};
use lemmy_server::code_migrations::run_advanced_migrations;
use lemmy_utils::{
apub::generate_actor_keypair,
rate_limit::{rate_limiter::RateLimiter, RateLimit},
@ -41,18 +44,25 @@ use lemmy_utils::{
use lemmy_websocket::{chat_server::ChatServer, LemmyContext};
use reqwest::Client;
use serde::{Deserialize, Serialize};
use std::sync::Arc;
use std::{ops::Deref, sync::Arc};
use tokio::sync::Mutex;
use url::Url;
embed_migrations!();
fn create_context() -> LemmyContext {
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 pool = Pool::builder()
.max_size(settings.database.pool_size)
.build(manager)
.unwrap();
embedded_migrations::run(&pool.get().unwrap()).unwrap();
run_advanced_migrations(pool.get().unwrap().deref()).unwrap();
let rate_limiter = RateLimit {
rate_limiter: Arc::new(Mutex::new(RateLimiter::default())),
};
@ -154,6 +164,7 @@ fn create_http_request() -> HttpRequest {
.to_http_request()
}
// TODO: this fails with a stack overflow for some reason
#[actix_rt::test]
#[ignore]
async fn test_shared_inbox_expired_signature() {
@ -172,7 +183,6 @@ async fn test_shared_inbox_expired_signature() {
}
#[actix_rt::test]
#[ignore]
async fn test_user_inbox_expired_signature() {
let request = create_http_request();
let context = create_context();
@ -192,7 +202,6 @@ async fn test_user_inbox_expired_signature() {
}
#[actix_rt::test]
#[ignore]
async fn test_community_inbox_expired_signature() {
let context = create_context();
let connection = &context.pool().get().unwrap();