summaryrefslogtreecommitdiffstats
path: root/src/registration.rs
diff options
context:
space:
mode:
authorPaul Woolcock <paul@woolcock.us>2018-08-25 14:12:14 -0400
committerPaul Woolcock <paul@woolcock.us>2018-08-26 08:41:38 -0400
commitaaa0edc98f562d6242b7caf8f674fe4e2b948fff (patch)
treecc92b41d1f97ef533049776bbc195073fd48c043 /src/registration.rs
parentdc70205757e7abacfb5331b030b3b6f4f6be1293 (diff)
Add a test for the default_redirect_uri
Diffstat (limited to 'src/registration.rs')
-rw-r--r--src/registration.rs9
1 files changed, 8 insertions, 1 deletions
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);
+ }
}