Moar tests!

This commit is contained in:
Matthew Scheirer 2017-09-17 22:44:44 -04:00
parent 3e71047f42
commit badd0b6a05
2 changed files with 17 additions and 4 deletions

View File

@ -110,6 +110,7 @@ pub fn jwks(client: &Client, url: Url) -> Result<JWKSet<Empty>, Error> {
#[test] #[test]
fn config_google() { fn config_google() {
// Formatting this took time off my lifespan...
let cfg = r#"{ "issuer": "https://accounts.google.com", let cfg = r#"{ "issuer": "https://accounts.google.com",
"authorization_endpoint": "https://accounts.google.com/o/oauth2/v2/auth", "authorization_endpoint": "https://accounts.google.com/o/oauth2/v2/auth",
"token_endpoint": "https://www.googleapis.com/oauth2/v4/token", "token_endpoint": "https://www.googleapis.com/oauth2/v4/token",
@ -129,7 +130,7 @@ fn config_google() {
"sub" ], "sub" ],
"code_challenge_methods_supported": [ "plain", "S256" ] "code_challenge_methods_supported": [ "plain", "S256" ]
}"#; }"#;
println!("{:?}", ::serde_json::from_str::<Config>(cfg).unwrap()); ::serde_json::from_str::<Config>(cfg).unwrap();
} }
#[test] #[test]
@ -142,5 +143,5 @@ fn config_minimum() {
"subject_types_supported": [ "public" ], "subject_types_supported": [ "public" ],
"id_token_signing_alg_values_supported": [ "RS256" ] "id_token_signing_alg_values_supported": [ "RS256" ]
}"#; }"#;
println!("{:?}", ::serde_json::from_str::<Config>(cfg).unwrap()); ::serde_json::from_str::<Config>(cfg).unwrap();
} }

View File

@ -11,11 +11,23 @@ pub fn paypal() -> Url {
} }
pub fn salesforce() -> Url { pub fn salesforce() -> Url {
Url::parse("http://login.salesforce.com").unwrap() Url::parse("https://login.salesforce.com").unwrap()
} }
#[test] #[test]
fn google_disco() { fn google_disco() {
let client = ::reqwest::Client::new().unwrap(); let client = ::reqwest::Client::new().unwrap();
let config = ::discovery::discover(&client, google()).unwrap(); ::discovery::discover(&client, google()).unwrap();
}
#[test]
fn paypal_disco() {
let client = ::reqwest::Client::new().unwrap();
::discovery::discover(&client, paypal()).unwrap();
}
#[test]
fn salesforce_disco() {
let client = ::reqwest::Client::new().unwrap();
::discovery::discover(&client, salesforce()).unwrap();
} }