extern crate lemmy_server;
+#[macro_use]
+extern crate diesel_migrations;
use activitystreams::{
activity::{
kind::{CreateType, FollowType},
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},
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())),
};
.to_http_request()
}
+// TODO: this fails with a stack overflow for some reason
#[actix_rt::test]
#[ignore]
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();
}
#[actix_rt::test]
-#[ignore]
async fn test_community_inbox_expired_signature() {
let context = create_context();
let connection = &context.pool().get().unwrap();