summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Network/BitTorrent/Tracker/RPCSpec.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/Network/BitTorrent/Tracker/RPCSpec.hs b/tests/Network/BitTorrent/Tracker/RPCSpec.hs
index dd91c3ce..31a04978 100644
--- a/tests/Network/BitTorrent/Tracker/RPCSpec.hs
+++ b/tests/Network/BitTorrent/Tracker/RPCSpec.hs
@@ -24,6 +24,10 @@ rpcOpts = def
24 { optUdpRPC = UDP.rpcOpts 24 { optUdpRPC = UDP.rpcOpts
25 } 25 }
26 26
27isUnrecognizedProtocol :: String -> RpcException -> Bool
28isUnrecognizedProtocol x (UnrecognizedProtocol scheme) = x == scheme
29isUnrecognizedProtocol _ _ = False
30
27spec :: Spec 31spec :: Spec
28spec = do 32spec = do
29 describe "Manager" $ do 33 describe "Manager" $ do
@@ -39,11 +43,16 @@ spec = do
39 describe "RPC" $ do 43 describe "RPC" $ do
40 describe "announce" $ do 44 describe "announce" $ do
41 it "must fail on bad uri scheme" $ do 45 it "must fail on bad uri scheme" $ do
42 pending 46 withManager rpcOpts def $ \ mgr -> do
47 q <- arbitrarySample
48 announce mgr "magnet://foo.bar" q
49 `shouldThrow` isUnrecognizedProtocol "magnet:"
43 50
44 describe "scrape" $ do 51 describe "scrape" $ do
45 it "must fail on bad uri scheme" $ do 52 it "must fail on bad uri scheme" $ do
46 pending 53 withManager rpcOpts def $ \ mgr -> do
54 scrape mgr "magnet://foo.bar" []
55 `shouldThrow` isUnrecognizedProtocol "magnet:"
47 56
48 forM_ trackers $ \ TrackerEntry {..} -> 57 forM_ trackers $ \ TrackerEntry {..} ->
49 context trackerName $ do 58 context trackerName $ do