forked from brendanhay/amazonka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBase64.hs
45 lines (41 loc) · 1.26 KB
/
Base64.hs
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
-- |
-- Module : Test.AWS.Data.Base64
-- Copyright : (c) 2013-2021 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <[email protected]>
-- Stability : provisional
-- Portability : non-portable (GHC extensions)
module Test.AWS.Data.Base64 (tests) where
import Network.AWS.Core
import Network.AWS.Prelude
import Network.HTTP.Types.URI (urlEncode)
import Test.AWS.Util
import Test.Tasty
tests :: TestTree
tests =
testGroup
"base64"
[ testGroup
"text"
[ testFromText "deserialise" encoded decoded,
testToText "serialise" encoded decoded
],
testGroup
"query"
[ testToQuery "serialise" ("x=" <> urlEncode True encoded) decoded
],
testGroup
"xml"
[ testFromXML "deserialise" encoded decoded,
testToXML "serialise" encoded decoded
],
testGroup
"json"
[ testFromJSON "deserialise" (str encoded) decoded,
testToJSON "serialise" (str encoded) decoded
]
]
encoded :: IsString a => a
encoded = "U2VkIHV0IHBlcnNwaWNpYXRpcyB1bmRlIG9tbmlzIGlzdGUgbmF0dXMgZXJyb3Igc2l0IHZvbHVwdGF0ZW0="
decoded :: Base64
decoded = Base64 "Sed ut perspiciatis unde omnis iste natus error sit voluptatem"