about summary refs log tree commit diff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2018-09-04T09·00+0200
committerVincent Ambo <mail@tazj.in>2018-09-04T10·45+0200
commit17e3a6560ac045fac56f354d40036264459cca44 (patch)
tree5fc30c40eff24502eef811e546478ccc42b5d6a1 /src/lib.rs
parentd3b200e820589fa8af8f47cd7e2bb76be006475b (diff)
refactor: Move tests to separate file
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/lib.rs b/src/lib.rs
index e424ca023191..d5d19ec2e037 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -59,6 +59,9 @@ use openssl::pkey::Public;
 use openssl::rsa::{Rsa};
 use openssl::error::ErrorStack;
 
+#[cfg(test)]
+mod tests;
+
 /// JWT algorithm used. The only supported algorithm is currently
 /// RS256.
 #[derive(Deserialize, Debug)]
@@ -185,16 +188,7 @@ fn public_key_from_jwk(jwk: &JWK) -> JWTResult<Rsa<Public>> {
     Rsa::from_public_components(jwk_n, jwk_e).map_err(Into::into)
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
 
-    #[test]
-    fn test_fragment_decoding() {
-        let fragment = "ngRRjNbXgPW29oNtF0JgsyyfTwPyEL0u_X16s453X2AOc33XGFxVKLEQ7R_TiMenaKcr-tPifYqgps_deyi0XOr4I3SOdOMtAVKDZJCANe--CANOHZb-meIfjKhCHisvT90fm5Apd6qPRVsXsZ7A8pmClZHKM5fwZUkBv8NsPLm2Xy2sGOZIiwP_7z8m3j0abUzniPQsx2b3xcWimB9vRtshFHN1KgPUf1ALQ5xzLfJnlFkCxC7kmOxKC7_NpQ4kJR_DKzKFV_r3HxTqf-jddHcXIrrMcLQXCSyeLQtLaz7whQ4F-EfL42z4XgwPr4ji3sct2gWL13EqlbE5DDxLKQ";
-        let bignum = decode_fragment(fragment).expect("Failed to decode fragment");
 
-        let expected = "19947781743618558124649689124245117083485690334420160711273532766920651190711502679542723943527557680293732686428091794139998732541701457212387600480039297092835433997837314251024513773285252960725418984381935183495143908023024822433135775773958512751261112853383693442999603704969543668619221464654540065497665889289271044207667765128672709218996183649696030570183970367596949687544839066873508106034650634722970893169823917299050098551447676778961773465887890052852528696684907153295689693676910831376066659456592813140662563597179711588277621736656871685099184755908108451080261403193680966083938080206832839445289";
-        assert_eq!(expected, format!("{}", bignum), "Decoded fragment should match ");
     }
 }