aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/Crypto/Macaroon/Verifier/Tests.hs
diff options
context:
space:
mode:
Diffstat (limited to 'test/Crypto/Macaroon/Verifier/Tests.hs')
-rw-r--r--test/Crypto/Macaroon/Verifier/Tests.hs18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/Crypto/Macaroon/Verifier/Tests.hs b/test/Crypto/Macaroon/Verifier/Tests.hs
index 5f09bca..101fa26 100644
--- a/test/Crypto/Macaroon/Verifier/Tests.hs
+++ b/test/Crypto/Macaroon/Verifier/Tests.hs
@@ -61,7 +61,7 @@ allvs = [exTC, exTZ, exV42, exV43, funTCPre, funTV43lte]
61sigs = testProperty "Signatures" $ \sm -> verifySig (secret sm) (macaroon sm) == Ok 61sigs = testProperty "Signatures" $ \sm -> verifySig (secret sm) (macaroon sm) == Ok
62 62
63firstParty = testGroup "First party caveats" [ 63firstParty = testGroup "First party caveats" [
64 testGroup "Pure verifiers" [ 64 testGroup "Pure verifiers" [
65 testProperty "Zero caveat" $ 65 testProperty "Zero caveat" $
66 forAll (sublistOf allvs) (\vs -> Ok == verifyCavs vs m) 66 forAll (sublistOf allvs) (\vs -> Ok == verifyCavs vs m)
67 , testProperty "One caveat" $ 67 , testProperty "One caveat" $
@@ -77,4 +77,20 @@ firstParty = testGroup "First party caveats" [
77 , Failed === verifyCavs vs m3 77 , Failed === verifyCavs vs m3
78 ]) 78 ])
79 ] 79 ]
80 , testGroup "Pure verifiers with sig" [
81 testProperty "Zero caveat" $
82 forAll (sublistOf allvs) (\vs -> Ok == verifyMacaroon sec vs m)
83 , testProperty "One caveat" $
84 forAll (sublistOf allvs) (\vs -> disjoin [
85 Ok == verifyMacaroon sec vs m2 .&&. any (`elem` vs) [exTC,funTCPre] .&&. (exTZ `notElem` vs)
86 , Failed === verifyMacaroon sec vs m2
87 ])
88 , testProperty "Two Exact" $
89 forAll (sublistOf allvs) (\vs -> disjoin [
90 Ok == verifyMacaroon sec vs m3 .&&.
91 any (`elem` vs) [exTC,funTCPre] .&&. (exTZ `notElem` vs) .&&.
92 any (`elem` vs) [exV42,funTV43lte] .&&. (exV43 `notElem` vs)
93 , Failed === verifyMacaroon sec vs m3
94 ])
95 ]
80 ] 96 ]