// This file is part of bsv. // // bsv is free software: you can redistribute it and/or modify it under the // terms of the GNU Affero General Public License as published by the Free // Software Foundation, either version 3 of the License, or (at your option) // any later version. // // cdb is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for // more details. // // You should have received a copy of the Affero GNU General Public License // along with cdb. If not, see . extern crate tempfile; extern crate libbsv; #[test] fn simple_db_has_object() { let temp_dir = tempfile::TempDir::new().unwrap(); let db = libbsv::SimpleDb::new(temp_dir.path()).unwrap(); let oid = libbsv::ObjectId::from_str("0001020304050607").unwrap(); assert!(!db.has_object(&oid)); let mut object_path: std::path::PathBuf = temp_dir.path().into(); object_path.push("objects"); object_path.push("0001"); std::fs::create_dir_all(&object_path).unwrap(); object_path.push("020304050607"); std::fs::write(object_path, "test").unwrap(); assert!(db.has_object(&oid)); }