Merge pull request 'test(filename_audit): seed library 2 before its image_exif row (#151)' (#154) from fix/filename-audit-test-fk into master
Reviewed-on: #154
This commit was merged in pull request #154.
This commit is contained in:
commit
79b339a2a6
2 files changed
+15
-1
No files matched your search
@@ -56,7 +56,7 @@ fn main() -> anyhow::Result<()> {
|
|||||||
&& let base = PathBuf::from(base)
|
&& let base = PathBuf::from(base)
|
||||||
&& !libraries
|
&& !libraries
|
||||||
.iter()
|
.iter()
|
||||||
.any(|l| PathBuf::from(&l.root_path) == base)
|
.any(|l| std::path::Path::new(&l.root_path) == base)
|
||||||
{
|
{
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"note: BASE_PATH ({}) does not match any library root; auditing the library table",
|
"note: BASE_PATH ({}) does not match any library root; auditing the library table",
|
||||||
|
|||||||
@@ -484,6 +484,20 @@ mod tests {
|
|||||||
// missing_root is never created -> probe fails.
|
// missing_root is never created -> probe fails.
|
||||||
|
|
||||||
let mut conn = migrated_conn();
|
let mut conn = migrated_conn();
|
||||||
|
// Migrations only seed library 1; image_exif.library_id is a
|
||||||
|
// foreign key, so library 2 must exist before its row does.
|
||||||
|
{
|
||||||
|
use crate::database::schema::libraries;
|
||||||
|
diesel::insert_into(libraries::table)
|
||||||
|
.values((
|
||||||
|
libraries::id.eq(2),
|
||||||
|
libraries::name.eq("offline"),
|
||||||
|
libraries::root_path.eq(missing_root.to_string_lossy().to_string()),
|
||||||
|
libraries::created_at.eq(1_700_000_000),
|
||||||
|
))
|
||||||
|
.execute(&mut conn)
|
||||||
|
.expect("seed library");
|
||||||
|
}
|
||||||
// Give the offline library a row so had_data=true (the strict
|
// Give the offline library a row so had_data=true (the strict
|
||||||
// probe: empty dir with rows is suspicious).
|
// probe: empty dir with rows is suspicious).
|
||||||
seed_row(&mut conn, 2, "whatever.jpg", Some(1), Some("exif"));
|
seed_row(&mut conn, 2, "whatever.jpg", Some(1), Some("exif"));
|
||||||
|
|||||||
Reference in new issue
Block a user