From aaa0edc98f562d6242b7caf8f674fe4e2b948fff Mon Sep 17 00:00:00 2001 From: Paul Woolcock Date: Sat, 25 Aug 2018 14:12:14 -0400 Subject: [PATCH] Add a test for the default_redirect_uri --- src/registration.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/registration.rs b/src/registration.rs index 9bc92af..a3465c2 100644 --- a/src/registration.rs +++ b/src/registration.rs @@ -9,6 +9,8 @@ use Mastodon; use MastodonBuilder; use Result; +const DEFAULT_REDIRECT_URI: &'static str = "urn:ietf:wg:oauth:2.0:oob"; + /// Handles registering your mastodon app to your instance. It is recommended /// you cache your data struct to avoid registering on every run. pub struct Registration<'a, H: HttpSend> { @@ -27,7 +29,7 @@ struct OAuth { } fn default_redirect_uri() -> String { - "urn:ietf:wg:oauth:2.0:oob".to_string() + DEFAULT_REDIRECT_URI.to_string() } #[derive(Deserialize)] @@ -233,4 +235,9 @@ mod tests { AppBuilder::new().website("https://website.example.com") ); } + + #[test] + fn test_default_redirect_uri() { + assert_eq!(&default_redirect_uri()[..], DEFAULT_REDIRECT_URI); + } }