diff options
Diffstat (limited to 'tests/Network/BitTorrent/Tracker')
-rw-r--r-- | tests/Network/BitTorrent/Tracker/RPCSpec.hs | 65 |
1 files changed, 42 insertions, 23 deletions
diff --git a/tests/Network/BitTorrent/Tracker/RPCSpec.hs b/tests/Network/BitTorrent/Tracker/RPCSpec.hs index 3b89714c..f8057d85 100644 --- a/tests/Network/BitTorrent/Tracker/RPCSpec.hs +++ b/tests/Network/BitTorrent/Tracker/RPCSpec.hs | |||
@@ -25,26 +25,45 @@ rpcOpts = def | |||
25 | 25 | ||
26 | spec :: Spec | 26 | spec :: Spec |
27 | spec = do | 27 | spec = do |
28 | forM_ trackers $ \ TrackerEntry {..} -> | 28 | describe "Manager" $ do |
29 | context trackerName $ do | 29 | describe "newManager" $ do |
30 | 30 | it "" $ pending | |
31 | describe "announce" $ do | 31 | |
32 | if tryAnnounce then do | 32 | describe "closeManager" $ do |
33 | it "have valid response" $ do | 33 | it "" $ pending |
34 | withManager rpcOpts def $ \ mgr -> do | 34 | |
35 | q <- arbitrarySample | 35 | describe "withManager" $ do |
36 | _ <- announce mgr trackerURI q | 36 | it "" $ pending |
37 | return () | 37 | |
38 | else do | 38 | describe "RPC" $ do |
39 | it "should throw exception" $ do | 39 | describe "announce" $ do |
40 | pending | 40 | it "must fail on bad uri scheme" $ do |
41 | 41 | pending | |
42 | describe "scrape" $ do | 42 | |
43 | if tryScraping then do | 43 | describe "scrape" $ do |
44 | it "have valid response" $ do | 44 | it "must fail on bad uri scheme" $ do |
45 | withManager rpcOpts def $ \ mgr -> do | 45 | pending |
46 | xs <- scrape mgr trackerURI [def] | 46 | |
47 | L.length xs `shouldSatisfy` (>= 1) | 47 | forM_ trackers $ \ TrackerEntry {..} -> |
48 | else do | 48 | context trackerName $ do |
49 | it "should throw exception" $ do | 49 | |
50 | pending | 50 | describe "announce" $ do |
51 | if tryAnnounce then do | ||
52 | it "have valid response" $ do | ||
53 | withManager rpcOpts def $ \ mgr -> do | ||
54 | q <- arbitrarySample | ||
55 | _ <- announce mgr trackerURI q | ||
56 | return () | ||
57 | else do | ||
58 | it "should throw exception" $ do | ||
59 | pending | ||
60 | |||
61 | describe "scrape" $ do | ||
62 | if tryScraping then do | ||
63 | it "have valid response" $ do | ||
64 | withManager rpcOpts def $ \ mgr -> do | ||
65 | xs <- scrape mgr trackerURI [def] | ||
66 | L.length xs `shouldSatisfy` (>= 1) | ||
67 | else do | ||
68 | it "should throw exception" $ do | ||
69 | pending | ||