diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-28 20:55:33 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-28 20:55:33 +0400 |
commit | f4f59ed1906aa9e7f4affc8ef0896355b2e33c8b (patch) | |
tree | 45a2b93f18f88789f28b0bc6d4666c789ff7134b /tests | |
parent | 1bc109b89d73cbd36ad4b03f5ff4d094b24f0c7d (diff) |
Spec: that if http tracker not responding...
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs | 15 |
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 | |||
26 | isUnrecognizedScheme (RequestFailed _) = True | 26 | isUnrecognizedScheme (RequestFailed _) = True |
27 | isUnrecognizedScheme _ = False | 27 | isUnrecognizedScheme _ = False |
28 | 28 | ||
29 | isNotResponding :: RpcException -> Bool | ||
30 | isNotResponding (RequestFailed _) = True | ||
31 | isNotResponding _ = False | ||
32 | |||
29 | spec :: Spec | 33 | spec :: Spec |
30 | spec = parallel $ do | 34 | spec = 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 | ||