diff options
Diffstat (limited to 'tests/Network/BitTorrent/Tracker')
-rw-r--r-- | tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs b/tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs index f9eb62d9..15c0ef4f 100644 --- a/tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs +++ b/tests/Network/BitTorrent/Tracker/RPC/HTTPSpec.hs | |||
@@ -23,30 +23,31 @@ validateInfo AnnounceQuery {..} AnnounceInfo {..} = do | |||
23 | 23 | ||
24 | spec :: Spec | 24 | spec :: Spec |
25 | spec = parallel $ do | 25 | spec = parallel $ do |
26 | forM_ (L.filter isHttpTracker trackers) $ \ TrackerEntry {..} -> | 26 | describe "RPC" $ do |
27 | context trackerName $ do | 27 | forM_ (L.filter isHttpTracker trackers) $ \ TrackerEntry {..} -> |
28 | 28 | context trackerName $ do | |
29 | describe "announce" $ do | 29 | |
30 | if tryAnnounce | 30 | describe "announce" $ do |
31 | then do | 31 | if tryAnnounce |
32 | it "have valid response" $ do | 32 | then do |
33 | withManager def $ \ mgr -> do | 33 | it "have valid response" $ do |
34 | -- q <- arbitrarySample | 34 | withManager def $ \ mgr -> do |
35 | let q = AnnounceQuery def "-HS0003-203534.37420" 6000 | 35 | -- q <- arbitrarySample |
36 | (Progress 0 0 0) Nothing Nothing (Just Started) | 36 | let q = AnnounceQuery def "-HS0003-203534.37420" 6000 |
37 | info <- announce mgr trackerURI q | 37 | (Progress 0 0 0) Nothing Nothing (Just Started) |
38 | validateInfo q info | 38 | info <- announce mgr trackerURI q |
39 | else do | 39 | validateInfo q info |
40 | it "should fail with RequestFailed" $ do | 40 | else do |
41 | pending | 41 | it "should fail with RequestFailed" $ do |
42 | 42 | pending | |
43 | describe "scrape" $ do | 43 | |
44 | if tryScraping | 44 | describe "scrape" $ do |
45 | then do | 45 | if tryScraping |
46 | it "have valid response" $ do | 46 | then do |
47 | withManager def $ \ mgr -> do | 47 | it "have valid response" $ do |
48 | xs <- scrape mgr trackerURI [def] | 48 | withManager def $ \ mgr -> do |
49 | L.length xs `shouldSatisfy` (>= 1) | 49 | xs <- scrape mgr trackerURI [def] |
50 | else do | 50 | L.length xs `shouldSatisfy` (>= 1) |
51 | it "should fail with ScrapelessTracker" $ do | 51 | else do |
52 | pending | 52 | it "should fail with ScrapelessTracker" $ do |
53 | pending | ||