git.iko.soy/typeable/mandrill
on messages-calls help sign in
52 lines 1.5 kB history raw
1{-# LANGUAGE OverloadedStrings #-}
2module Online where
4import Test.QuickCheck
5import Test.Tasty.HUnit
6import Text.RawString.QQ
7import Data.Either
8import Data.Aeson
9import Network.API.Mandrill.Messages.Types
10import Network.API.Mandrill.Users.Types
11import qualified Data.ByteString.Char8 as C8
12import RawData
14import Network.API.Mandrill.Types
15import qualified Network.API.Mandrill.Messages as API
16import qualified Network.API.Mandrill.Users as API
18--
19-- Users calls
20--
21testOnlineUsersInfo :: MandrillKey -> Assertion
22testOnlineUsersInfo k = do
23 res <- API.info k
24 case res of
25 MandrillSuccess _ -> return ()
26 MandrillFailure e -> fail $ "users/info.json " ++ show e
28testOnlineUsersPing2 :: MandrillKey -> Assertion
29testOnlineUsersPing2 k = do
30 res <- API.ping2 k
31 case res of
32 MandrillSuccess _ -> return ()
33 MandrillFailure e -> fail $ "users/ping2.json " ++ show e
35testOnlineUsersSenders :: MandrillKey -> Assertion
36testOnlineUsersSenders k = do
37 res <- API.senders k
38 case res of
39 MandrillSuccess _ -> return ()
40 MandrillFailure e -> fail $ "users/senders.json " ++ show e
43--
44-- Messages calls
45--
46testOnlineMessagesSend :: MandrillKey -> Assertion
47testOnlineMessagesSend k = do
48 msg <- generate arbitrary
49 res <- API.send k msg Nothing Nothing Nothing
50 case res of
51 MandrillSuccess _ -> return ()
52 MandrillFailure e -> fail $ "messages/send.json " ++ show e