summaryrefslogtreecommitdiff
path: root/tests/Network/BitTorrent/Tracker/SessionSpec.hs
blob: 0c75fcaa901dc6d31036ebdf3da5e891eb60f33f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module Network.BitTorrent.Tracker.SessionSpec (spec) where
import Data.Default
import Data.List as L
import Network.URI
import Test.Hspec

import Data.Torrent
import Network.BitTorrent.Tracker.List
import Network.BitTorrent.Tracker.RPC.UDPSpec (trackerURIs)
import Network.BitTorrent.Tracker.RPC
import Network.BitTorrent.Tracker.Session


trackers :: TrackerList URI
trackers = trackerList def { tAnnounceList = Just [trackerURIs] }

spec :: Spec
spec = do
  describe "Session" $ do
    it "" $ do
      withManager def def $ \ m -> do
        s <- newSession def trackers
        notify m s Started
        peers <- askPeers m s
        peers `shouldSatisfy` (not . L.null)