diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2013-11-28 15:50:58 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2013-11-28 15:50:58 +0400 |
commit | c5f59076b8e259d5ee84f9c3da08da22bb7cff5e (patch) | |
tree | b85345213572b582f41c0a8524b3d0de5469f0bd /tests/Network/BitTorrent/Tracker/MessageSpec.hs | |
parent | e2edd7436a287160d993815e2dc1ad9792435b9c (diff) |
Remove urlencoded stuff completely
Diffstat (limited to 'tests/Network/BitTorrent/Tracker/MessageSpec.hs')
-rw-r--r-- | tests/Network/BitTorrent/Tracker/MessageSpec.hs | 14 |
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 | ||
43 | baseURI :: URI | ||
44 | baseURI = fromJust $ parseURI "http://a" | ||
45 | |||
46 | parseUriQuery :: URI -> SimpleQuery | ||
47 | parseUriQuery = 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 | |||
55 | spec :: Spec | 43 | spec :: Spec |
56 | spec = do | 44 | spec = 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 |