mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-12-25 03:20:32 +00:00
8a4702df92
Add tests for following models: - Blog - Instance - Media - User
26 lines
621 B
Rust
26 lines
621 B
Rust
extern crate diesel;
|
|
#[macro_use]
|
|
extern crate diesel_migrations;
|
|
|
|
extern crate plume_models;
|
|
|
|
use diesel::Connection;
|
|
use plume_models::{Connection as Conn, DATABASE_URL};
|
|
|
|
#[cfg(feature = "sqlite")]
|
|
embed_migrations!("../migrations/sqlite");
|
|
|
|
#[cfg(feature = "postgres")]
|
|
embed_migrations!("../migrations/postgres");
|
|
|
|
fn db() -> Conn {
|
|
let conn = Conn::establish(&*DATABASE_URL.as_str()).expect("Couldn't connect to the database");
|
|
embedded_migrations::run(&conn).expect("Couldn't run migrations");
|
|
conn
|
|
}
|
|
|
|
#[test]
|
|
fn empty_test() {
|
|
let conn = &db();
|
|
conn.test_transaction::<_, (), _>(|| Ok(()));
|
|
}
|