summaryrefslogtreecommitdiff
path: root/tests/Network/BitTorrent
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Network/BitTorrent')
-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)