Skip to content

Commit

Permalink
chore: apply clippy suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: Jérémie Drouet <jeremie.drouet@datadoghq.com>
  • Loading branch information
jdrouet committed Aug 22, 2023
1 parent 0553975 commit 6a9aa8f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
17 changes: 14 additions & 3 deletions src/tvshow/season/details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ mod tests {
#[tokio::test]
async fn it_works() {
let mut server = mockito::Server::new_async().await;
let client = Client::new("secret".into()).with_base_url(server.url());
let client = Client::builder()
.with_api_key("secret".into())
.with_base_url(server.url())
.build();

let _m = server
.mock("GET", "/tv/1399/season/1")
Expand All @@ -90,7 +93,11 @@ mod tests {
#[tokio::test]
async fn invalid_api_key() {
let mut server = mockito::Server::new_async().await;
let client = Client::new("secret".into()).with_base_url(server.url());
let client = Client::builder()
.with_api_key("secret".into())
.with_base_url(server.url())
.build()
.unwrap();

let _m = server
.mock("GET", "/tv/1399/season/1")
Expand All @@ -112,7 +119,11 @@ mod tests {
#[tokio::test]
async fn resource_not_found() {
let mut server = mockito::Server::new_async().await;
let client = Client::new("secret".into()).with_base_url(server.url());
let client = Client::builder()
.with_api_key("secret".into())
.with_base_url(server.url())
.build()
.unwrap();

let _m = server
.mock("GET", "/tv/1399/season/1")
Expand Down
4 changes: 2 additions & 2 deletions src/util/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ mod tests {
#[test]
fn should_serialize() {
let value = TestingStruct {
value: chrono::NaiveDate::from_ymd(1990, 1, 22),
value: chrono::NaiveDate::from_ymd_opt(1990, 1, 22).unwrap(),
};
let result = serde_json::to_string(&value).unwrap();
assert_eq!(result, r#"{"value":"1990-01-22"}"#);
}

#[test]
fn should_deserialize() {
let date = chrono::NaiveDate::from_ymd(1990, 1, 22);
let date = chrono::NaiveDate::from_ymd_opt(1990, 1, 22).unwrap();
let result: TestingStruct = serde_json::from_str(r#"{"value":"1990-01-22"}"#).unwrap();
assert_eq!(result.value, date);
}
Expand Down

0 comments on commit 6a9aa8f

Please sign in to comment.