Skip to content

Commit 583ceb8

Browse files
committed
Add authentication error test
1 parent f463a5d commit 583ceb8

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/client_tests.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@ mod mock {
3939
});
4040
}
4141

42+
#[test]
43+
fn search_with_authentication_error() {
44+
b!(async {
45+
let response = podcast_api::Client::new(Some("wrong_key"))
46+
.search(&json!({
47+
"q": "dummy",
48+
"sort_by_date": 1
49+
}))
50+
.await
51+
.unwrap();
52+
assert_eq!(response.response.status(), http::StatusCode::UNAUTHORIZED);
53+
});
54+
}
55+
4256
#[test]
4357
fn typeahead() {
4458
b!(async {

0 commit comments

Comments
 (0)