Safe Haskell | None |
---|---|
Language | Haskell2010 |
Test.Sandwich.Contexts.FakeSmtpServer
Description
This module provides functions for introducing a mock SMTP server, represented by FakeSmtpServer
.
If you send emails to this server, you can read them out to confirm they were received correctly.
Synopsis
- introduceFakeSmtpServerNix :: forall context (m :: Type -> Type). (BaseMonad context m, HasNixContext context) => FakeSmtpServerOptions -> SpecFree (FakeSmtpServerContext context) m () -> SpecFree context m ()
- introduceFakeSmtpServerNix' :: forall context (m :: Type -> Type). (BaseMonad context m, HasNixContext context) => Text -> FakeSmtpServerOptions -> SpecFree (FakeSmtpServerContext context) m () -> SpecFree context m ()
- introduceFakeSmtpServer :: forall context (m :: Type -> Type). (BaseMonad context m, HasFile context "fake-smtp-server") => FakeSmtpServerOptions -> SpecFree (LabelValue "fakeSmtpServer" FakeSmtpServer :> context) m () -> SpecFree context m ()
- withFakeSMTPServer :: (BaseMonad context m, MonadReader context m, MonadLoggerIO m, HasFile context "fake-smtp-server") => FakeSmtpServerOptions -> (FakeSmtpServer -> m [Result]) -> m ()
- fakeSmtpServerDerivation :: Text
- fakeSmtpServer :: Label "fakeSmtpServer" FakeSmtpServer
- data FakeSmtpServerOptions = FakeSmtpServerOptions {}
- defaultFakeSmtpServerOptions :: FakeSmtpServerOptions
- data FakeSmtpServer = FakeSmtpServer {
- fakeSmtpServerHostname :: HostName
- fakeSmtpServerSmtpPort :: PortNumber
- fakeSmtpServerGetEmails :: forall (m :: Type -> Type). (MonadLoggerIO m, MonadUnliftIO m, MonadThrow m) => m [EmailInfo]
- data EmailInfo = EmailInfo {}
Introduce a fake SMTP server
introduceFakeSmtpServerNix Source #
Arguments
:: forall context (m :: Type -> Type). (BaseMonad context m, HasNixContext context) | |
=> FakeSmtpServerOptions | Options |
-> SpecFree (FakeSmtpServerContext context) m () | Child spec |
-> SpecFree context m () | Parent spec |
Introduce a fake SMTP server using a Nix derivation hardcoded into this package as fakeSmtpServerDerivation
.
introduceFakeSmtpServerNix' Source #
Arguments
:: forall context (m :: Type -> Type). (BaseMonad context m, HasNixContext context) | |
=> Text | Nix derivation |
-> FakeSmtpServerOptions | Options |
-> SpecFree (FakeSmtpServerContext context) m () | Child spec |
-> SpecFree context m () | Parent spec |
Same as introduceFakeSmtpServerNix
, but allows you to specify the derivation.
introduceFakeSmtpServer Source #
Arguments
:: forall context (m :: Type -> Type). (BaseMonad context m, HasFile context "fake-smtp-server") | |
=> FakeSmtpServerOptions | Options |
-> SpecFree (LabelValue "fakeSmtpServer" FakeSmtpServer :> context) m () | |
-> SpecFree context m () |
Introduce a fake SMTP server given a binary already available via HasFile
.
Bracket-style version
Arguments
:: (BaseMonad context m, MonadReader context m, MonadLoggerIO m, HasFile context "fake-smtp-server") | |
=> FakeSmtpServerOptions | Options |
-> (FakeSmtpServer -> m [Result]) | |
-> m () |
Bracket-style version of introduceFakeSmtpServer
.
Nix derivation
fakeSmtpServerDerivation :: Text Source #
A Nix derivation to build a fake Node.js SMTP server, based on https://github.com/ReachFive/fake-smtp-server.
Types
fakeSmtpServer :: Label "fakeSmtpServer" FakeSmtpServer Source #
data FakeSmtpServerOptions Source #
Constructors
FakeSmtpServerOptions | |
Fields
|
Instances
Show FakeSmtpServerOptions Source # | |
Defined in Test.Sandwich.Contexts.FakeSmtpServer Methods showsPrec :: Int -> FakeSmtpServerOptions -> ShowS # show :: FakeSmtpServerOptions -> String # showList :: [FakeSmtpServerOptions] -> ShowS # | |
Eq FakeSmtpServerOptions Source # | |
Defined in Test.Sandwich.Contexts.FakeSmtpServer Methods (==) :: FakeSmtpServerOptions -> FakeSmtpServerOptions -> Bool # (/=) :: FakeSmtpServerOptions -> FakeSmtpServerOptions -> Bool # |
data FakeSmtpServer Source #
Constructors
FakeSmtpServer | |
Fields
|