From 791e2958fc1c5c3f9efe88f84db798fcaea319bb Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 26 Feb 2019 16:47:51 +0100 Subject: test: Add test for token-based authentication (bearer_auth) --- src/tests.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/tests.rs b/src/tests.rs index 088334aa2784..9fce04b15f21 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -92,6 +92,15 @@ fn test_http_post_json() { // Tests for different authentication methods that are supported // out-of-the-box: +#[test] +fn test_bearer_auth() { + let response = Request::new(Method::Get, "https://httpbin.org/bearer") + .bearer_auth("some-token").expect("failed to set auth header") + .send().expect("failed to send request"); + + assert!(response.is_success(), "authorized request should succeed"); +} + #[cfg(feature = "basic_auth")] #[test] fn test_basic_auth() { let request = Request::new( -- cgit 1.4.1