Archived
1
0
Fork 0

chore: remove sqlite database before test

This commit is contained in:
Dmitriy Pleshevskiy 2021-05-23 12:33:14 +03:00
parent 1602069eb5
commit 128047723d

View file

@ -528,17 +528,19 @@ mod upgrade {
})?; })?;
#[cfg(any(feature = "sqlite", feature = "rusqlite"))] #[cfg(any(feature = "sqlite", feature = "rusqlite"))]
inner("sqlite_invalid", || { remove_sqlite_db().and_then(|_| {
use rusqlite::Connection; inner("sqlite_invalid", || {
use rusqlite::Connection;
let conn = Connection::open(SQLITE_URL)?; let conn = Connection::open(SQLITE_URL)?;
let articles_res = conn.execute_batch("SELECT a.id FROM articles AS a"); let articles_res = conn.execute_batch("SELECT a.id FROM articles AS a");
let persons_res = conn.execute_batch("SELECT p.id FROM persons AS p"); let persons_res = conn.execute_batch("SELECT p.id FROM persons AS p");
assert!(articles_res.is_ok()); assert!(articles_res.is_ok());
assert!(persons_res.is_err()); assert!(persons_res.is_err());
Ok(()) Ok(())
})
})?; })?;
Ok(()) Ok(())
@ -578,17 +580,19 @@ mod upgrade {
})?; })?;
#[cfg(any(feature = "sqlite", feature = "rusqlite"))] #[cfg(any(feature = "sqlite", feature = "rusqlite"))]
inner("sqlite_invalid", || { remove_sqlite_db().and_then(|_| {
use rusqlite::Connection; inner("sqlite_invalid", || {
use rusqlite::Connection;
let conn = Connection::open(SQLITE_URL)?; let conn = Connection::open(SQLITE_URL)?;
let articles_res = conn.execute_batch("SELECT a.id FROM articles AS a"); let articles_res = conn.execute_batch("SELECT a.id FROM articles AS a");
let persons_res = conn.execute_batch("SELECT p.id FROM persons AS p"); let persons_res = conn.execute_batch("SELECT p.id FROM persons AS p");
assert!(articles_res.is_err()); assert!(articles_res.is_err());
assert!(persons_res.is_err()); assert!(persons_res.is_err());
Ok(()) Ok(())
})
})?; })?;
Ok(()) Ok(())