summaryrefslogtreecommitdiff
path: root/tests/Network/BitTorrent
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-03-15 19:02:23 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-03-15 19:02:23 +0400
commit57c07536dd59595ec4cbcce24f0e6352e99a82c6 (patch)
tree6c378dadb4625ba20bdde87153d0f30d99afe8d1 /tests/Network/BitTorrent
parente80c53754833a0c37e318bf1ba10847e21d1d980 (diff)
Add exchange session spec stubs
Diffstat (limited to 'tests/Network/BitTorrent')
-rw-r--r--tests/Network/BitTorrent/Exchange/SessionSpec.hs66
1 files changed, 47 insertions, 19 deletions
diff --git a/tests/Network/BitTorrent/Exchange/SessionSpec.hs b/tests/Network/BitTorrent/Exchange/SessionSpec.hs
index f80fc864..0eec8f41 100644
--- a/tests/Network/BitTorrent/Exchange/SessionSpec.hs
+++ b/tests/Network/BitTorrent/Exchange/SessionSpec.hs
@@ -12,25 +12,53 @@ import Config
12nullLogger :: LogFun 12nullLogger :: LogFun
13nullLogger _ _ x _ = print x 13nullLogger _ _ x _ = print x
14 14
15simpleSession :: InfoDict -> (Session -> IO ()) -> IO ()
16simpleSession dict action = do
17 withRemoteAddr $ \ addr -> do
18 myAddr <- getMyAddr
19 ses <- newSession nullLogger myAddr "" dict
20 connect addr ses
21 action ses
22 closeSession ses
23
15spec :: Spec 24spec :: Spec
16spec = do 25spec = do
17 describe "metadata exchange" $ do 26 describe "construction" $ do
18 it "should fetch info dictionary" $ do 27 describe "newSession" $ do
19 withRemoteAddr $ \ addr -> do 28 it "" $ do
29 pending
30
31 describe "closeSession" $ do
32 it "" $ do
33 pending
34
35 describe "connection set" $ do
36 describe "connect" $ do
37 it "" $ do
38 pending
39
40 describe "establish" $ do
41 it "" $ do
42 pending
43
44 describe "exchange" $ do
45 describe "metadata" $ do
46 it "should fetch info dictionary" $ do
20 Torrent {..} <- getTestTorrent 47 Torrent {..} <- getTestTorrent
21 myAddr <- getMyAddr 48 simpleSession tInfoDict $ \ ses -> do
22 ses <- newSession nullLogger myAddr "" tInfoDict 49 dict <- waitMetadata ses
23 connect addr ses 50 dict `shouldBe` tInfoDict
24 dict <- waitMetadata ses 51
25 closeSession ses 52 it "should serve info dictionary" $ do
26 dict `shouldBe` tInfoDict 53 pending
27 54
28 it "should serve info dictionary" $ do 55 describe "content" $ do
29 pending 56 it "should fetch torrent content" $ do
30 57 Torrent {..} <- getTestTorrent
31 describe "content exchange" $ do 58 simpleSession tInfoDict $ \ ses -> do
32 it "should fetch torrent content" $ do 59 pending
33 pending 60-- st <- waitData ses
34 61-- verifyStorage st (idPieceInfo tInfoDict)
35 it "should serve torrent content" $ do 62
36 pending 63 it "should serve torrent content" $ do
64 pending