summaryrefslogtreecommitdiff
path: root/tests/Network/BitTorrent/DHT
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-02-19 01:45:12 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-02-19 01:45:12 +0400
commit81b71a4a9f0a6f9fd64de08d2dd22303b169a076 (patch)
tree5e364431594649ab2376006f1174b2fddceffc3b /tests/Network/BitTorrent/DHT
parent879074f286a602848d3edff10de36e88a9622cbc (diff)
Return Bool instead of raising exception in checkToken
Diffstat (limited to 'tests/Network/BitTorrent/DHT')
-rw-r--r--tests/Network/BitTorrent/DHT/SessionSpec.hs16
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/Network/BitTorrent/DHT/SessionSpec.hs b/tests/Network/BitTorrent/DHT/SessionSpec.hs
index 75c95462..3e197875 100644
--- a/tests/Network/BitTorrent/DHT/SessionSpec.hs
+++ b/tests/Network/BitTorrent/DHT/SessionSpec.hs
@@ -2,6 +2,7 @@
2module Network.BitTorrent.DHT.SessionSpec (spec) where 2module Network.BitTorrent.DHT.SessionSpec (spec) where
3import Control.Monad.Reader 3import Control.Monad.Reader
4import Data.Default 4import Data.Default
5import Data.List as L
5import Test.Hspec 6import Test.Hspec
6import Test.QuickCheck 7import Test.QuickCheck
7 8
@@ -33,14 +34,17 @@ spec = do
33 describe "tokens" $ do 34 describe "tokens" $ do
34 it "should not complain about valid token" $ 35 it "should not complain about valid token" $
35 property $ \ (addrs :: [NodeAddr IPv4]) -> do 36 property $ \ (addrs :: [NodeAddr IPv4]) -> do
36 simpleDHT $ do 37 isOks <- simpleDHT $ do
37 forM_ addrs $ \ addr -> do 38 forM addrs $ \ addr -> do
38 token <- grantToken addr 39 token <- grantToken addr
39 checkToken addr token 40 checkToken addr token
40{- 41 L.and isOks `shouldBe` True
41 it "" $ property $ \ (addr :: NodeAddr IPv4) token -> do 42
42 simpleDHT (checkToken addr token) `shouldThrow` (== undefined) 43 it "should complain about invalid token" $
43-} 44 property $ \ (addr :: NodeAddr IPv4) token -> do
45 isOk <- simpleDHT (checkToken addr token)
46 isOk `shouldBe` False
47
44 describe "routing table" $ do 48 describe "routing table" $ do
45 return () 49 return ()
46 50