Cargo update; fixes RUSTSEC-2020-0071 and RUSTSEC-2023-0044
Fix the tests for small changes in Rocket 0.5-rc.4. Also fix the usage of a deprecate method.
This commit is contained in:
parent
ff10cc19e8
commit
f830d34464
File diff suppressed because it is too large
Load Diff
12
src/lib.rs
12
src/lib.rs
|
@ -366,7 +366,7 @@ mod tests {
|
||||||
|
|
||||||
// No metric selected, don't know which map to show?
|
// No metric selected, don't know which map to show?
|
||||||
let response = client.get("/map?address=eindhoven").dispatch();
|
let response = client.get("/map?address=eindhoven").dispatch();
|
||||||
assert_eq!(response.status(), Status::NotFound);
|
assert_eq!(response.status(), Status::UnprocessableEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -375,10 +375,6 @@ mod tests {
|
||||||
let maps_handle_clone = Arc::clone(&maps_handle);
|
let maps_handle_clone = Arc::clone(&maps_handle);
|
||||||
let client = Client::tracked(rocket(maps_handle)).expect("Not a valid Rocket instance");
|
let client = Client::tracked(rocket(maps_handle)).expect("Not a valid Rocket instance");
|
||||||
|
|
||||||
// No metric passed, don't know which map to show?
|
|
||||||
let response = client.get("/map?lat=51.4&lon=5.5").dispatch();
|
|
||||||
assert_eq!(response.status(), Status::NotFound);
|
|
||||||
|
|
||||||
// No maps available yet.
|
// No maps available yet.
|
||||||
let response = client.get("/map?lat=51.4&lon=5.5&metric=pollen").dispatch();
|
let response = client.get("/map?lat=51.4&lon=5.5&metric=pollen").dispatch();
|
||||||
assert_eq!(response.status(), Status::ServiceUnavailable);
|
assert_eq!(response.status(), Status::ServiceUnavailable);
|
||||||
|
@ -395,8 +391,12 @@ mod tests {
|
||||||
assert_eq!(response.status(), Status::Ok);
|
assert_eq!(response.status(), Status::Ok);
|
||||||
assert_eq!(response.content_type(), Some(ContentType::PNG));
|
assert_eq!(response.content_type(), Some(ContentType::PNG));
|
||||||
|
|
||||||
|
// ... but not if it is out of bounds.
|
||||||
|
let response = client.get("/map?lat=0.0&lon=0.0&metric=pollen").dispatch();
|
||||||
|
assert_eq!(response.status(), Status::NotFound);
|
||||||
|
|
||||||
// No metric passed, don't know which map to show?
|
// No metric passed, don't know which map to show?
|
||||||
let response = client.get("/map?lat=51.4&lon=5.5").dispatch();
|
let response = client.get("/map?lat=51.4&lon=5.5").dispatch();
|
||||||
assert_eq!(response.status(), Status::NotFound);
|
assert_eq!(response.status(), Status::UnprocessableEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ use std::f64::consts::PI;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
use chrono::serde::ts_seconds;
|
use chrono::serde::ts_seconds;
|
||||||
use chrono::{DateTime, Duration, NaiveDateTime, Utc};
|
use chrono::{DateTime, Duration, NaiveDateTime, TimeZone, Utc};
|
||||||
use image::{
|
use image::{
|
||||||
DynamicImage, GenericImage, GenericImageView, ImageError, ImageFormat, Pixel, Rgb, Rgba,
|
DynamicImage, GenericImage, GenericImageView, ImageError, ImageFormat, Pixel, Rgb, Rgba,
|
||||||
};
|
};
|
||||||
|
@ -449,7 +449,7 @@ async fn retrieve_image(url: Url) -> Result<RetrievedMaps> {
|
||||||
.ok_or_else(|| Error::InvalidImagePath(path.to_owned()))?;
|
.ok_or_else(|| Error::InvalidImagePath(path.to_owned()))?;
|
||||||
let timestamp = NaiveDateTime::parse_from_str(timestamp_str, "%Y%m%d%H%M")?;
|
let timestamp = NaiveDateTime::parse_from_str(timestamp_str, "%Y%m%d%H%M")?;
|
||||||
|
|
||||||
DateTime::<Utc>::from_utc(timestamp, Utc)
|
Utc.from_utc_datetime(×tamp)
|
||||||
};
|
};
|
||||||
let bytes = response.bytes().await?;
|
let bytes = response.bytes().await?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue