From 86f3882318d323d1920ca1c7da6e816f0ed376da Mon Sep 17 00:00:00 2001 From: Julien Tanguy Date: Mon, 17 Aug 2015 17:38:24 +0200 Subject: Change verifier api and split Verifier module - Added haddocks --- test/Crypto/Macaroon/Verifier/Internal/Tests.hs | 30 +++++++++++++++++++++++++ test/Crypto/Macaroon/Verifier/Tests.hs | 28 ++++++----------------- 2 files changed, 37 insertions(+), 21 deletions(-) create mode 100644 test/Crypto/Macaroon/Verifier/Internal/Tests.hs (limited to 'test/Crypto/Macaroon/Verifier') diff --git a/test/Crypto/Macaroon/Verifier/Internal/Tests.hs b/test/Crypto/Macaroon/Verifier/Internal/Tests.hs new file mode 100644 index 0000000..cd75118 --- /dev/null +++ b/test/Crypto/Macaroon/Verifier/Internal/Tests.hs @@ -0,0 +1,30 @@ +{-# LANGUAGE OverloadedStrings #-} +{-| +Copyright : (c) 2015 Julien Tanguy +License : BSD3 + +Maintainer : julien.tanguy@jhome.fr + + +This test suite is based on the pymacaroons test suite: + +-} +module Crypto.Macaroon.Verifier.Internal.Tests where + +import qualified Data.ByteString.Char8 as B8 +import Data.List +import Test.Tasty +-- import Test.Tasty.HUnit +import Data.Either +import Test.Tasty.QuickCheck hiding (Failure, Success) + +import Crypto.Macaroon +import Crypto.Macaroon.Verifier.Internal + +import Crypto.Macaroon.Instances + +tests :: TestTree +tests = testGroup "Crypto.Macaroon.Verifier.Internal" [ sigs + ] + +sigs = testProperty "Signatures" $ \sm -> verifySig (secret sm) (macaroon sm) == Right (macaroon sm) diff --git a/test/Crypto/Macaroon/Verifier/Tests.hs b/test/Crypto/Macaroon/Verifier/Tests.hs index 670c991..b6220eb 100644 --- a/test/Crypto/Macaroon/Verifier/Tests.hs +++ b/test/Crypto/Macaroon/Verifier/Tests.hs @@ -12,21 +12,20 @@ This test suite is based on the pymacaroons test suite: module Crypto.Macaroon.Verifier.Tests where -import Data.List -import qualified Data.ByteString.Char8 as B8 -import Test.Tasty +import qualified Data.ByteString.Char8 as B8 +import Data.List +import Test.Tasty -- import Test.Tasty.HUnit -import Test.Tasty.QuickCheck hiding (Success, Failure) -import Data.Either +import Data.Either +import Test.Tasty.QuickCheck hiding (Failure, Success) import Crypto.Macaroon import Crypto.Macaroon.Verifier -import Crypto.Macaroon.Instances +import Crypto.Macaroon.Instances tests :: TestTree -tests = testGroup "Crypto.Macaroon.Verifier" [ sigs - ] +tests = testGroup "Crypto.Macaroon.Verifier" [ ] {- - Test fixtures @@ -45,22 +44,9 @@ m2 = addFirstPartyCaveat "test = caveat" m m3 :: Macaroon m3 = addFirstPartyCaveat "value = 42" m2 --- exTC = verifyExact "test" "caveat" (many' letter_ascii) --- exTZ = verifyExact "test" "bleh" (many' letter_ascii) --- exV42 = verifyExact "value" 42 decimal --- exV43 = verifyExact "value" 43 decimal - --- funTCPre = verifyFun "test" (string "test = " *> many' letter_ascii) --- (\e -> if "cav" `isPrefixOf` e then Right e else Left "Does not start with cav" ) --- funTV43lte = verifyFun "value" (string "value = " *> decimal) --- (\v -> if v <= 43 then Right v else Left "Greater than 43") - --- allvs = [exTC, exTZ, exV42, exV43, funTCPre, funTV43lte] - {- - Tests -} -sigs = testProperty "Signatures" $ \sm -> verifySig (secret sm) (macaroon sm) == Right (macaroon sm) -- TODO: Re-do tests {- -- cgit v1.2.3