From 2bc8c967b14a59b67d16b4946903f9e3534f2fe5 Mon Sep 17 00:00:00 2001 From: bjoern Date: Tue, 30 Nov 2021 13:55:07 +0100 Subject: [PATCH] really test MX lookup in test_oauth_from_mx() (#2854) --- src/oauth2.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/oauth2.rs b/src/oauth2.rs index aae7c7bdd..f919a3faf 100644 --- a/src/oauth2.rs +++ b/src/oauth2.rs @@ -378,13 +378,17 @@ mod tests { #[async_std::test] async fn test_oauth_from_mx() { - // TODO: this does not test MX lookup, google.com is in our provider-db - // does anyone know a "good" Google Workspace (former G Suite) domain we can use for testing? + // youtube staff seems to use "google workspace with oauth2", figures this out by MX lookup let t = TestContext::new().await; assert_eq!( - Oauth2::from_address(&t, "hello@google.com", false).await, + Oauth2::from_address(&t, "hello@youtube.com", false).await, Some(OAUTH2_GMAIL) ); + // without MX lookup, we would not know as youtube.com is not in our provider-db + assert_eq!( + Oauth2::from_address(&t, "hello@youtube.com", true).await, + None + ); } #[async_std::test]