Skip to content

Commit

Permalink
cache tests: no need to mock ref housenumbers files anymore
Browse files Browse the repository at this point in the history
Change-Id: Ie485b789262f08f8d3e6ad85de69e786704aa20d
  • Loading branch information
vmiklos committed Aug 20, 2024
1 parent d2815ed commit 6b4441a
Showing 1 changed file with 2 additions and 37 deletions.
39 changes: 2 additions & 37 deletions src/cache/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,11 @@ fn test_get_missing_housenumbers_json() {
},
});
let yamls_cache_value = context::tests::TestFileSystem::write_json_to_file(&yamls_cache);
let ref_housenumbers = context::tests::TestFileSystem::make_file();
let files = context::tests::TestFileSystem::make_files(
&ctx,
&[
("data/yamls.cache", &yamls_cache_value),
(
"workdir/street-housenumbers-reference-gazdagret.lst",
&ref_housenumbers,
),
],
&[("data/yamls.cache", &yamls_cache_value)],
);
file_system.set_files(&files);
let mut mtimes: HashMap<String, Rc<RefCell<time::OffsetDateTime>>> = HashMap::new();
mtimes.insert(
ctx.get_abspath("workdir/street-housenumbers-reference-gazdagret.lst"),
Rc::new(RefCell::new(time::OffsetDateTime::UNIX_EPOCH)),
);
file_system.set_mtimes(&mtimes);
let file_system_rc: Rc<dyn context::FileSystem> = Rc::new(file_system);
ctx.set_file_system(&file_system_rc);
let mut relations = areas::Relations::new(&ctx).unwrap();
Expand Down Expand Up @@ -90,24 +77,11 @@ fn test_get_missing_housenumbers_json_sql_newer() {
},
});
let yamls_cache_value = context::tests::TestFileSystem::write_json_to_file(&yamls_cache);
let ref_housenumbers = context::tests::TestFileSystem::make_file();
let files = context::tests::TestFileSystem::make_files(
&ctx,
&[
("data/yamls.cache", &yamls_cache_value),
(
"workdir/street-housenumbers-reference-gazdagret.lst",
&ref_housenumbers,
),
],
&[("data/yamls.cache", &yamls_cache_value)],
);
file_system.set_files(&files);
let mut mtimes: HashMap<String, Rc<RefCell<time::OffsetDateTime>>> = HashMap::new();
mtimes.insert(
ctx.get_abspath("workdir/street-housenumbers-reference-gazdagret.lst"),
Rc::new(RefCell::new(time::OffsetDateTime::UNIX_EPOCH)),
);
file_system.set_mtimes(&mtimes);
let file_system_rc: Rc<dyn context::FileSystem> = Rc::new(file_system);
ctx.set_file_system(&file_system_rc);
let mut relations = areas::Relations::new(&ctx).unwrap();
Expand Down Expand Up @@ -180,25 +154,16 @@ fn test_get_missing_housenumbers_json_file_newer() {
},
});
let yamls_cache_value = context::tests::TestFileSystem::write_json_to_file(&yamls_cache);
let ref_housenumbers = context::tests::TestFileSystem::make_file();
let relation_file = context::tests::TestFileSystem::make_file();
let files = context::tests::TestFileSystem::make_files(
&ctx,
&[
("data/yamls.cache", &yamls_cache_value),
(
"workdir/street-housenumbers-reference-gazdagret.lst",
&ref_housenumbers,
),
("data/relation-gazdagret.yaml", &relation_file),
],
);
file_system.set_files(&files);
let mut mtimes: HashMap<String, Rc<RefCell<time::OffsetDateTime>>> = HashMap::new();
mtimes.insert(
ctx.get_abspath("workdir/street-housenumbers-reference-gazdagret.lst"),
Rc::new(RefCell::new(time::OffsetDateTime::UNIX_EPOCH)),
);
mtimes.insert(
ctx.get_abspath("data/relation-gazdagret.yaml"),
Rc::new(RefCell::new(ctx.get_time().now())),
Expand Down

0 comments on commit 6b4441a

Please sign in to comment.