2019-03-27 11:35:24 +00:00
|
|
|
import ./make-test.nix ({ lib, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
name = "mailcatcher";
|
|
|
|
meta.maintainers = [ lib.maintainers.aanderse ];
|
|
|
|
|
|
|
|
machine =
|
|
|
|
{ pkgs, ... }:
|
|
|
|
{
|
|
|
|
services.mailcatcher.enable = true;
|
|
|
|
|
2019-11-24 15:38:52 +00:00
|
|
|
services.ssmtp.enable = true;
|
|
|
|
services.ssmtp.hostName = "localhost:1025";
|
2019-03-27 11:35:24 +00:00
|
|
|
|
|
|
|
environment.systemPackages = [ pkgs.mailutils ];
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
startAll;
|
|
|
|
|
|
|
|
$machine->waitForUnit('mailcatcher.service');
|
|
|
|
$machine->waitForOpenPort('1025');
|
|
|
|
$machine->succeed('echo "this is the body of the email" | mail -s "subject" root@example.org');
|
2019-03-28 15:15:20 +00:00
|
|
|
$machine->succeed('curl http://localhost:1080/messages/1.source') =~ /this is the body of the email/ or die;
|
2019-03-27 11:35:24 +00:00
|
|
|
'';
|
|
|
|
})
|