summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs b/tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs
new file mode 100644
index 00000000..141a2597
--- /dev/null
+++ b/tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs
@@ -0,0 +1,35 @@
1module Network.BitTorrent.Tracker.RPC.HTTPSpec (spec) where
2
3import Control.Monad
4import Control.Monad.Trans
5import Control.Monad.Trans.Resource
6import Data.Default
7import Data.List as L
8import Data.Maybe
9import Network.URI
10import Test.Hspec
11
12import Network.BitTorrent.Tracker.RPC.MessageSpec hiding (spec)
13import Network.BitTorrent.Tracker.RPC.HTTP
14
15
16trackerURIs :: [URI]
17trackerURIs =
18 [ fromJust $ parseURI "http://announce.opensharing.org:2710/announce"
19 , fromJust $ parseURI "http://exodus.desync.com/announce"
20 ]
21
22spec :: Spec
23spec = do
24 forM_ trackerURIs $ \ uri ->
25 context (show uri) $ do
26 describe "announce" $ do
27 it "have valid response" $ do
28 q <- arbitrarySample
29 info <- runResourceT $ connect uri >>= announce q
30 validateInfo q info
31
32 describe "scrape" $ do
33 it "have valid response" $ do
34 xs <- runResourceT $ connect uri >>= scrape [def]
35 L.length xs `shouldSatisfy` (>= 1)