summaryrefslogtreecommitdiff
path: root/tests/Network/BitTorrent/Tracker
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Network/BitTorrent/Tracker')
-rw-r--r--tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs b/tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs
index 2a00c96c..65f58911 100644
--- a/tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs
+++ b/tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs
@@ -26,6 +26,10 @@ isUnrecognizedScheme :: RpcException -> Bool
26isUnrecognizedScheme (RequestFailed _) = True 26isUnrecognizedScheme (RequestFailed _) = True
27isUnrecognizedScheme _ = False 27isUnrecognizedScheme _ = False
28 28
29isNotResponding :: RpcException -> Bool
30isNotResponding (RequestFailed _) = True
31isNotResponding _ = False
32
29spec :: Spec 33spec :: Spec
30spec = parallel $ do 34spec = parallel $ do
31 describe "Manager" $ do 35 describe "Manager" $ do
@@ -68,7 +72,10 @@ spec = parallel $ do
68 validateInfo q info 72 validateInfo q info
69 else do 73 else do
70 it "should fail with RequestFailed" $ do 74 it "should fail with RequestFailed" $ do
71 pending 75 withManager def $ \ mgr -> do
76 q <- arbitrarySample
77 announce mgr trackerURI q
78 `shouldThrow` isNotResponding
72 79
73 describe "scrape" $ do 80 describe "scrape" $ do
74 if tryScraping 81 if tryScraping
@@ -80,3 +87,9 @@ spec = parallel $ do
80 else do 87 else do
81 it "should fail with ScrapelessTracker" $ do 88 it "should fail with ScrapelessTracker" $ do
82 pending 89 pending
90
91 when (not tryAnnounce) $ do
92 it "should fail with RequestFailed" $ do
93 withManager def $ \ mgr -> do
94 scrape mgr trackerURI [def]
95 `shouldThrow` isNotResponding