summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakob L. Kreuze <zerodaysfordays@sdf.org>2020-05-18 16:28:22 -0400
committerJakob L. Kreuze <zerodaysfordays@sdf.org>2020-05-18 16:28:22 -0400
commit508b6e3d77fb1c671bb3ebd6ef760ef25da2c9cc (patch)
treed2123e6411523da220fe2326654f6efffd492322 /src
parent491aba6f20d3064fe779fffe265a603591d552ae (diff)
Test `import_file`.
Diffstat (limited to 'src')
-rw-r--r--src/main.rs19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index 54ab708..033f562 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -150,11 +150,24 @@ mod tests {
.unwrap()
.exists(params![table])
.unwrap();
- if !exists {
- panic!("Table {} did not exist", table);
- }
+ assert!(exists);
}
}
+
+ #[test]
+ fn insert_file() {
+ let tb = TagBase::make_temporary().unwrap();
+ let id = tb
+ .import_image(Path::new("/fake/path"), "fakehash")
+ .unwrap();
+ let exists = tb
+ .conn
+ .prepare("SELECT filename, blake2 FROM images WHERE id = ?;")
+ .unwrap()
+ .exists(params![id])
+ .unwrap();
+ assert!(exists);
+ }
}
fn main() {