@@ -5,6 +5,7 @@
5module Network.API.Mandrill.Types where
5module Network.API.Mandrill.Types where
7import Network.API.Mandrill.Utils
7import Network.API.Mandrill.Utils
8import Data.Char
9import Data.Char
9import Data.Time
10import Data.Time
10import Control.Applicative
11import Control.Applicative
@@ -97,6 +98,8 @@ data MandrillRecipient = MandrillRecipient {
97makeLenses ''MandrillRecipient
98makeLenses ''MandrillRecipient
98deriveJSON defaultOptions { fieldLabelModifier = drop 6 } ''MandrillRecipient
99deriveJSON defaultOptions { fieldLabelModifier = drop 6 } ''MandrillRecipient
101+instance Arbitrary MandrillRecipient where
102+ arbitrary = pure $ MandrillRecipient "test@example.com" Nothing Nothing
101--------------------------------------------------------------------------------
104--------------------------------------------------------------------------------
102newtype MandrillHtml = MandrillHtml Blaze.Html
105newtype MandrillHtml = MandrillHtml Blaze.Html
@@ -117,6 +120,8 @@ instance FromJSON MandrillHtml where
117 parseJSON (String h) = return $ MandrillHtml (Blaze.toHtml h)
120 parseJSON (String h) = return $ MandrillHtml (Blaze.toHtml h)
118 parseJSON v = typeMismatch "Expecting a String for MandrillHtml" v
121 parseJSON v = typeMismatch "Expecting a String for MandrillHtml" v
123+instance Arbitrary MandrillHtml where
124+ arbitrary = pure $ mkMandrillHtml "<p><b>FooBar</b></p>"
121--------------------------------------------------------------------------------
126--------------------------------------------------------------------------------
122-- | The information on the message to send
127-- | The information on the message to send
@@ -138,6 +143,13 @@ data MandrillMessage = MandrillMessage {
138makeLenses ''MandrillMessage
143makeLenses ''MandrillMessage
139deriveJSON defaultOptions { fieldLabelModifier = drop 6 } ''MandrillMessage
144deriveJSON defaultOptions { fieldLabelModifier = drop 6 } ''MandrillMessage
146+instance Arbitrary MandrillMessage where
147+ arbitrary = MandrillMessage <$> arbitrary
149+ <*> pure "Test Subject"
150+ <*> pure "sender@example.com"
152+ <*> resize 2 arbitrary
142--------------------------------------------------------------------------------
154--------------------------------------------------------------------------------
143type MandrillKey = T.Text
155type MandrillKey = T.Text