aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorJulien Tanguy <julien.tanguy@jhome.fr>2015-08-16 23:22:10 +0200
committerJulien Tanguy <julien.tanguy@jhome.fr>2015-08-16 23:22:10 +0200
commit7f9f7386fdbe8d19ef30ebd20939e67cc8bb145c (patch)
treeea8eea3c4e8c35db822b46e502049fc81e891aa3 /test
parentc830f7c2cf925ce340f4097d76ea2a3bc94cb4a6 (diff)
downloadhmacaroons-7f9f7386fdbe8d19ef30ebd20939e67cc8bb145c.tar.gz
hmacaroons-7f9f7386fdbe8d19ef30ebd20939e67cc8bb145c.tar.zst
hmacaroons-7f9f7386fdbe8d19ef30ebd20939e67cc8bb145c.zip
Basic validation functions
Still needs testing [ci skip]
Diffstat (limited to 'test')
-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 -}