From be278da91e6c97e31c5611721b1bbd593fcd99b9 Mon Sep 17 00:00:00 2001 From: Julien Tanguy Date: Mon, 5 Oct 2015 18:35:03 +0200 Subject: Dedicated VerifierResult The Maybe (Either ValidationError ()) return type was too cryptic, now there is a real datatype for it. The validation part is unchanged and still uses the Maybe Either type --- test/Crypto/Macaroon/Verifier/Internal/Tests.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/Crypto/Macaroon/Verifier/Internal/Tests.hs b/test/Crypto/Macaroon/Verifier/Internal/Tests.hs index 826b631..59980de 100644 --- a/test/Crypto/Macaroon/Verifier/Internal/Tests.hs +++ b/test/Crypto/Macaroon/Verifier/Internal/Tests.hs @@ -45,19 +45,19 @@ m = create sec key loc m2 :: Macaroon m2 = addFirstPartyCaveat "test = caveat" m -vtest :: Caveat -> IO (Maybe (Either ValidationError ())) +vtest :: Caveat -> IO VerifierResult vtest c = return $ if "test" `BS.isPrefixOf` cid c then - Just $ bool (Left (ValidatorError "Failed")) (Right ()) $ "test = caveat" == cid c - else Nothing + bool (Refused (ValidatorError "Failed")) Verified $ "test = caveat" == cid c + else Unrelated m3 :: Macaroon m3 = addFirstPartyCaveat "value = 42" m2 -vval :: Caveat -> IO (Maybe (Either ValidationError ())) +vval :: Caveat -> IO VerifierResult vval c = return $ if "value" `BS.isPrefixOf` cid c then - Just $ bool (Left (ValidatorError "Failed")) (Right ()) $ "value = 42" == cid c - else Nothing + bool (Refused (ValidatorError "Failed")) Verified $ "value = 42" == cid c + else Unrelated {- -- cgit v1.2.3