Skip to content

Commit 6cb2299

Browse files
fix tests
1 parent 27fb409 commit 6cb2299

File tree

1 file changed

+91
-8
lines changed
  • services/src/datasets/external/wildlive

1 file changed

+91
-8
lines changed

services/src/datasets/external/wildlive/mod.rs

Lines changed: 91 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -429,13 +429,13 @@ impl<D: GeoEngineDb> LayerCollectionProvider for WildliveDataConnector<D> {
429429
metadata: Default::default(),
430430
}),
431431
WildliveLayerId::ProjectBounds => Ok(Layer {
432-
id: self.layer_id(WildliveLayerId::Projects)?,
432+
id: self.layer_id(WildliveLayerId::ProjectBounds)?,
433433
name: "Project Bounds".to_string(),
434434
description: "Overview of all project bounds".to_string(),
435435
workflow: Workflow {
436436
operator: OgrSource {
437437
params: OgrSourceParameters {
438-
data: self.named_data(WildliveLayerId::Projects)?,
438+
data: self.named_data(WildliveLayerId::ProjectBounds)?,
439439
attribute_projection: None,
440440
attribute_filters: None,
441441
},
@@ -1195,22 +1195,24 @@ mod tests {
11951195
};
11961196

11971197
let layer = connector
1198-
.load_layer(&WildliveLayerId::Projects.try_into().unwrap())
1198+
.load_layer(&WildliveLayerId::ProjectBounds.try_into().unwrap())
11991199
.await
12001200
.unwrap();
12011201
assert_eq!(
12021202
layer,
12031203
Layer {
12041204
id: ProviderLayerId {
12051205
provider_id: connector.definition.id,
1206-
layer_id: WildliveLayerId::Projects.try_into().unwrap(),
1206+
layer_id: WildliveLayerId::ProjectBounds.try_into().unwrap(),
12071207
},
1208-
name: "Projects".to_string(),
1209-
description: "Overview of all projects".to_string(),
1208+
name: "Project Bounds".to_string(),
1209+
description: "Overview of all project bounds".to_string(),
12101210
workflow: Workflow {
12111211
operator: OgrSource {
12121212
params: OgrSourceParameters {
1213-
data: connector.named_data(WildliveLayerId::Projects).unwrap(),
1213+
data: connector
1214+
.named_data(WildliveLayerId::ProjectBounds)
1215+
.unwrap(),
12141216
attribute_projection: None,
12151217
attribute_filters: None,
12161218
},
@@ -1224,6 +1226,85 @@ mod tests {
12241226
}
12251227
);
12261228

1229+
let layer = connector
1230+
.load_layer(&WildliveLayerId::Projects.try_into().unwrap())
1231+
.await
1232+
.unwrap();
1233+
assert_eq!(
1234+
layer,
1235+
Layer {
1236+
id: ProviderLayerId {
1237+
provider_id: connector.definition.id,
1238+
layer_id: WildliveLayerId::Projects.try_into().unwrap(),
1239+
},
1240+
name: "Projects".to_string(),
1241+
description: "Overview of all projects".to_string(),
1242+
workflow: Workflow {
1243+
operator: VectorExpression {
1244+
params: VectorExpressionParams {
1245+
expression: "centroid(geom)".into(),
1246+
input_columns: Vec::new(),
1247+
output_column: GeoVectorDataType::MultiPoint.into(),
1248+
geometry_column_name: "geom".into(),
1249+
output_measurement: Measurement::Unitless,
1250+
},
1251+
sources: SingleVectorSource {
1252+
vector: OgrSource {
1253+
params: OgrSourceParameters {
1254+
data: connector.named_data(WildliveLayerId::Projects).unwrap(),
1255+
attribute_projection: None,
1256+
attribute_filters: None,
1257+
},
1258+
}
1259+
.boxed(),
1260+
},
1261+
}
1262+
.boxed()
1263+
.into(),
1264+
},
1265+
symbology: Some(Symbology::Point(PointSymbology {
1266+
r#type: Default::default(),
1267+
radius: NumberParam::Static(StaticNumber {
1268+
r#type: Default::default(),
1269+
value: 10,
1270+
}),
1271+
fill_color: ColorParam::Static(StaticColor {
1272+
r#type: Default::default(),
1273+
color: RgbaColor::new(103, 156, 96, 255),
1274+
}),
1275+
stroke: StrokeParam {
1276+
color: ColorParam::Static(StaticColor {
1277+
r#type: Default::default(),
1278+
color: RgbaColor::black(),
1279+
}),
1280+
width: NumberParam::Static(StaticNumber {
1281+
r#type: Default::default(),
1282+
value: 1,
1283+
}),
1284+
},
1285+
text: Some(TextSymbology {
1286+
attribute: "name".into(),
1287+
fill_color: ColorParam::Static(StaticColor {
1288+
r#type: Default::default(),
1289+
color: RgbaColor::white(),
1290+
}),
1291+
stroke: StrokeParam {
1292+
color: ColorParam::Static(StaticColor {
1293+
r#type: Default::default(),
1294+
color: RgbaColor::black(),
1295+
}),
1296+
width: NumberParam::Static(StaticNumber {
1297+
r#type: Default::default(),
1298+
value: 1,
1299+
}),
1300+
},
1301+
}),
1302+
})),
1303+
properties: Vec::new(),
1304+
metadata: Default::default(),
1305+
}
1306+
);
1307+
12271308
let metadata: Box<
12281309
dyn MetaData<OgrSourceDataset, VectorResultDescriptor, VectorQueryRectangle>,
12291310
> = MetaDataProvider::<OgrSourceDataset, VectorResultDescriptor, VectorQueryRectangle>
@@ -1347,6 +1428,7 @@ mod tests {
13471428
request::method("GET"),
13481429
request::path("/api/objects/wildlive/ef7833589d61b2d2a905"),
13491430
])
1431+
.times(2)
13501432
.respond_with(json_responder(test_data!(
13511433
"wildlive/responses/project.json"
13521434
))),
@@ -1472,6 +1554,7 @@ mod tests {
14721554
};
14731555

14741556
let project_id = "wildlive/ef7833589d61b2d2a905";
1557+
let project_name = "CameraTrapping project in Bolivia";
14751558

14761559
let layer = connector
14771560
.load_layer(
@@ -1494,7 +1577,7 @@ mod tests {
14941577
.try_into()
14951578
.unwrap(),
14961579
},
1497-
name: format!("Captures for project {project_id}"),
1580+
name: format!("Captures for project {project_name}"),
14981581
description: format!("Overview of all captures within project {project_id}"),
14991582
workflow: Workflow {
15001583
operator: OgrSource {

0 commit comments

Comments
 (0)