summaryrefslogtreecommitdiff
path: root/tests/Network/BitTorrent/Tracker
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2013-12-13 14:05:00 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2013-12-13 14:05:00 +0400
commit2027b99f7a12986c6c0cb9d3205e0893fba17c9a (patch)
tree042e0471bcfc4a125ce479dff17df4fc89aee008 /tests/Network/BitTorrent/Tracker
parent8ddb71a490ec862d1df626b7eb9300d9ddb782f3 (diff)
Update client example
Diffstat (limited to 'tests/Network/BitTorrent/Tracker')
-rw-r--r--tests/Network/BitTorrent/Tracker/RPCSpec.hs29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/Network/BitTorrent/Tracker/RPCSpec.hs b/tests/Network/BitTorrent/Tracker/RPCSpec.hs
new file mode 100644
index 00000000..6bc72e86
--- /dev/null
+++ b/tests/Network/BitTorrent/Tracker/RPCSpec.hs
@@ -0,0 +1,29 @@
1module Network.BitTorrent.Tracker.RPCSpec (spec) where
2import Control.Monad
3import Data.Default
4import Data.List as L
5import Network.URI
6import Test.Hspec
7
8import Network.BitTorrent.Tracker.MessageSpec hiding (spec)
9import Network.BitTorrent.Tracker.RPC.HTTPSpec as HTTP hiding (spec)
10import Network.BitTorrent.Tracker.RPC.UDPSpec as UDP hiding (spec)
11import Network.BitTorrent.Tracker.RPC as RPC
12
13uris :: [URI]
14uris = UDP.trackerURIs ++ HTTP.trackerURIs
15
16spec :: Spec
17spec = do
18 forM_ uris $ \ uri ->
19 context (show uri) $ do
20 describe "announce" $ do
21 it "have valid response" $ do
22 q <- arbitrarySample
23 info <- connect uri >>= announce q
24 validateInfo q info
25
26 describe "scrape" $ do
27 it "have valid response" $ do
28 xs <- connect uri >>= scrape [def]
29 L.length xs `shouldSatisfy` (>= 1)