diff options
Diffstat (limited to 'tests/Network/BitTorrent/Tracker/RPC')
-rw-r--r-- | tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs | 16 |
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 | |||
12 | import Network.BitTorrent.Tracker.RPC.HTTP | 12 | import Network.BitTorrent.Tracker.RPC.HTTP |
13 | 13 | ||
14 | import Network.BitTorrent.Tracker.TestData | 14 | import Network.BitTorrent.Tracker.TestData |
15 | import Network.BitTorrent.Tracker.MessageSpec hiding (spec) | ||
15 | 16 | ||
16 | 17 | ||
17 | validateInfo :: AnnounceQuery -> AnnounceInfo -> Expectation | 18 | validateInfo :: 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 | ||
25 | isUnrecognizedScheme :: RpcException -> Bool | ||
26 | isUnrecognizedScheme (RequestFailed _) = True | ||
27 | isUnrecognizedScheme _ = False | ||
28 | |||
24 | spec :: Spec | 29 | spec :: Spec |
25 | spec = parallel $ do | 30 | spec = 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 |