aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/Crypto/Macaroon
diff options
context:
space:
mode:
authorJulien Tanguy <julien.tanguy@jhome.fr>2015-05-16 12:51:22 +0200
committerJulien Tanguy <julien.tanguy@jhome.fr>2015-05-16 12:51:22 +0200
commit62576139b8dbf2cd0d3c04e927b9df2d0805a199 (patch)
tree3bf3c0104c4051aa94b8cce5b667b0b19a6c6d5b /test/Crypto/Macaroon
parent90695615c54b5939d7286e777cb1b19a221616b9 (diff)
downloadhmacaroons-62576139b8dbf2cd0d3c04e927b9df2d0805a199.tar.gz
hmacaroons-62576139b8dbf2cd0d3c04e927b9df2d0805a199.tar.zst
hmacaroons-62576139b8dbf2cd0d3c04e927b9df2d0805a199.zip
Add Sig/cav verifier
[ci skip]
Diffstat (limited to 'test/Crypto/Macaroon')
-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 ]