summaryrefslogtreecommitdiff
path: root/tests/Network/BitTorrent/Tracker/MessageSpec.hs
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2013-11-28 15:50:58 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2013-11-28 15:50:58 +0400
commitc5f59076b8e259d5ee84f9c3da08da22bb7cff5e (patch)
treeb85345213572b582f41c0a8524b3d0de5469f0bd /tests/Network/BitTorrent/Tracker/MessageSpec.hs
parente2edd7436a287160d993815e2dc1ad9792435b9c (diff)
Remove urlencoded stuff completely
Diffstat (limited to 'tests/Network/BitTorrent/Tracker/MessageSpec.hs')
-rw-r--r--tests/Network/BitTorrent/Tracker/MessageSpec.hs14
1 files changed, 1 insertions, 13 deletions
diff --git a/tests/Network/BitTorrent/Tracker/MessageSpec.hs b/tests/Network/BitTorrent/Tracker/MessageSpec.hs
index 44dc2c7a..a95cf0d7 100644
--- a/tests/Network/BitTorrent/Tracker/MessageSpec.hs
+++ b/tests/Network/BitTorrent/Tracker/MessageSpec.hs
@@ -40,23 +40,11 @@ instance Arbitrary AnnounceQuery where
40 <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary 40 <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
41 <*> arbitrary <*> arbitrary <*> arbitrary 41 <*> arbitrary <*> arbitrary <*> arbitrary
42 42
43baseURI :: URI
44baseURI = fromJust $ parseURI "http://a"
45
46parseUriQuery :: URI -> SimpleQuery
47parseUriQuery = filterMaybes . parseQuery . BC.pack . uriQuery
48 where
49 filterMaybes :: [(a, Maybe b)] -> [(a, b)]
50 filterMaybes = catMaybes . L.map f
51 where
52 f (a, Nothing) = Nothing
53 f (a, Just b ) = Just (a, b)
54
55spec :: Spec 43spec :: Spec
56spec = do 44spec = do
57 describe "Announce" $ do 45 describe "Announce" $ do
58 it "properly url encoded" $ property $ \ q -> 46 it "properly url encoded" $ property $ \ q ->
59 parseAnnounceQuery (parseUriQuery (renderAnnounceQuery baseURI q)) 47 parseAnnounceQuery (renderAnnounceQuery q)
60 `shouldBe` Right q 48 `shouldBe` Right q
61 49
62 describe "Scrape" $ do 50 describe "Scrape" $ do