Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

areas tests: use more execute_batch() #3761

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions src/areas/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,22 +555,16 @@ fn test_relation_get_osm_streets() {
#[test]
fn test_relation_get_osm_streets_street_is_node() {
let ctx = context::tests::make_test_context().unwrap();
let mtime = ctx.get_time().now_string();
{
let conn = ctx.get_database_connection().unwrap();
conn.execute(
"insert into osm_housenumbers (relation, osm_id, street, housenumber, postcode, place, housename, conscriptionnumber, flats, floor, door, unit, name, osm_type) values (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14)",
["gh830", "3136661536", "Bártfai utca", "52/b", "1115", "", "", "", "", "", "", "", "", "node"],
)
.unwrap();
conn.execute(
"insert into mtimes (page, last_modified) values (?1, ?2)",
["housenumbers/gh830", &mtime],
conn.execute_batch(
"insert into osm_housenumbers (relation, osm_id, street, housenumber, postcode, place, housename, conscriptionnumber, flats, floor, door, unit, name, osm_type) values ('myrelation', '3136661536', 'Bártfai utca', '52/b', '1115', '', '', '', '', '', '', '', '', 'node');
insert into mtimes (page, last_modified) values ('housenumbers/myrelation', '0')",
)
.unwrap();
}
let mut relations = Relations::new(&ctx).unwrap();
let relation = relations.get_relation("gh830").unwrap();
let relation = relations.get_relation("myrelation").unwrap();
let actual = relation.get_osm_streets(/*sorted_result=*/ true).unwrap();
assert_eq!(actual.len(), 1);
assert_eq!(actual[0].get_osm_type(), "node");
Expand Down
Loading