Add a test for the default_redirect_uri

This commit is contained in:
Paul Woolcock
2018-08-26 08:41:38 -04:00
parent dc70205757
commit aaa0edc98f
+8 -1
View File
@@ -9,6 +9,8 @@ use Mastodon;
use MastodonBuilder; use MastodonBuilder;
use Result; 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 /// Handles registering your mastodon app to your instance. It is recommended
/// you cache your data struct to avoid registering on every run. /// you cache your data struct to avoid registering on every run.
pub struct Registration<'a, H: HttpSend> { pub struct Registration<'a, H: HttpSend> {
@@ -27,7 +29,7 @@ struct OAuth {
} }
fn default_redirect_uri() -> String { fn default_redirect_uri() -> String {
"urn:ietf:wg:oauth:2.0:oob".to_string() DEFAULT_REDIRECT_URI.to_string()
} }
#[derive(Deserialize)] #[derive(Deserialize)]
@@ -233,4 +235,9 @@ mod tests {
AppBuilder::new().website("https://website.example.com") AppBuilder::new().website("https://website.example.com")
); );
} }
#[test]
fn test_default_redirect_uri() {
assert_eq!(&default_redirect_uri()[..], DEFAULT_REDIRECT_URI);
}
} }