summaryrefslogtreecommitdiff
path: root/tests/Network/BitTorrent/Tracker/RPC
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Network/BitTorrent/Tracker/RPC')
-rw-r--r--tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs16
1 files changed, 13 insertions, 3 deletions
diff --git a/tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs b/tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs
index 5288e304..f82263ee 100644
--- a/tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs
+++ b/tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs
@@ -12,6 +12,7 @@ import Network.BitTorrent.Tracker.Message as Message
12import Network.BitTorrent.Tracker.RPC.HTTP 12import Network.BitTorrent.Tracker.RPC.HTTP
13 13
14import Network.BitTorrent.Tracker.TestData 14import Network.BitTorrent.Tracker.TestData
15import Network.BitTorrent.Tracker.MessageSpec hiding (spec)
15 16
16 17
17validateInfo :: AnnounceQuery -> AnnounceInfo -> Expectation 18validateInfo :: AnnounceQuery -> AnnounceInfo -> Expectation
@@ -21,6 +22,10 @@ validateInfo AnnounceQuery {..} AnnounceInfo {..} = do
21 Nothing -> return () 22 Nothing -> return ()
22 Just n -> n `shouldBe` L.length (getPeerList respPeers) 23 Just n -> n `shouldBe` L.length (getPeerList respPeers)
23 24
25isUnrecognizedScheme :: RpcException -> Bool
26isUnrecognizedScheme (RequestFailed _) = True
27isUnrecognizedScheme _ = False
28
24spec :: Spec 29spec :: Spec
25spec = parallel $ do 30spec = parallel $ do
26 describe "Manager" $ do 31 describe "Manager" $ do
@@ -36,11 +41,16 @@ spec = parallel $ do
36 describe "RPC" $ do 41 describe "RPC" $ do
37 describe "announce" $ do 42 describe "announce" $ do
38 it "must fail on bad uri scheme" $ do 43 it "must fail on bad uri scheme" $ do
39 pending 44 withManager def $ \ mgr -> do
45 q <- arbitrarySample
46 announce mgr "magnet://foo.bar" q
47 `shouldThrow` isUnrecognizedScheme
40 48
41 describe "scrape" $ do 49 describe "scrape" $ do
42 it "fail on bad uri scheme" $ do 50 it "must fail on bad uri scheme" $ do
43 pending 51 withManager def $ \ mgr -> do
52 scrape mgr "magnet://foo.bar" []
53 `shouldThrow` isUnrecognizedScheme
44 54
45 forM_ (L.filter isHttpTracker trackers) $ \ TrackerEntry {..} -> 55 forM_ (L.filter isHttpTracker trackers) $ \ TrackerEntry {..} ->
46 context trackerName $ do 56 context trackerName $ do