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.hs36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/Crypto/Macaroon/Verifier/Tests.hs b/test/Crypto/Macaroon/Verifier/Tests.hs
index 4a9295f..670c991 100644
--- a/test/Crypto/Macaroon/Verifier/Tests.hs
+++ b/test/Crypto/Macaroon/Verifier/Tests.hs
@@ -63,3 +63,39 @@ m3 = addFirstPartyCaveat "value = 42" m2
63sigs = testProperty "Signatures" $ \sm -> verifySig (secret sm) (macaroon sm) == Right (macaroon sm) 63sigs = testProperty "Signatures" $ \sm -> verifySig (secret sm) (macaroon sm) == Right (macaroon sm)
64 64
65-- TODO: Re-do tests 65-- TODO: Re-do tests
66{-
67firstParty = testGroup "First party caveats" [
68 testGroup "Pure verifiers" [
69 testProperty "Zero caveat" $
70 forAll (sublistOf allvs) (\vs -> Right m == verifyCavs vs m)
71 , testProperty "One caveat" $
72 forAll (sublistOf allvs) (\vs -> disjoin [
73 Right m2 == verifyCavs vs m2 .&&. any (`elem` vs) [exTC,funTCPre] .&&. (exTZ `notElem` vs)
74 , True === isLeft( verifyCavs vs m2)
75 ])
76 , testProperty "Two Exact" $
77 forAll (sublistOf allvs) (\vs -> disjoin [
78 Right m3 == verifyCavs vs m3 .&&.
79 any (`elem` vs) [exTC,funTCPre] .&&. (exTZ `notElem` vs) .&&.
80 any (`elem` vs) [exV42,funTV43lte] .&&. (exV43 `notElem` vs)
81 , True === isLeft (verifyCavs vs m3)
82 ])
83 ]
84 , testGroup "Pure verifiers with sig" [
85 testProperty "Zero caveat" $
86 forAll (sublistOf allvs) (\vs -> Right m == verifyMacaroon sec vs m)
87 , testProperty "One caveat" $
88 forAll (sublistOf allvs) (\vs -> disjoin [
89 Right m2 == verifyMacaroon sec vs m2 .&&. any (`elem` vs) [exTC,funTCPre] .&&. (exTZ `notElem` vs)
90 , True === isLeft (verifyMacaroon sec vs m2)
91 ])
92 , testProperty "Two Exact" $
93 forAll (sublistOf allvs) (\vs -> disjoin [
94 Right m3 == verifyMacaroon sec vs m3 .&&.
95 any (`elem` vs) [exTC,funTCPre] .&&. (exTZ `notElem` vs) .&&.
96 any (`elem` vs) [exV42,funTV43lte] .&&. (exV43 `notElem` vs)
97 , True === isLeft (verifyMacaroon sec vs m3)
98 ])
99 ]
100 ]
101 -}