3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/tests/prosody.nix

39 lines
1.1 KiB
Nix
Raw Normal View History

2018-03-21 13:27:20 +00:00
import ./make-test.nix {
name = "prosody";
machine = { pkgs, ... }: {
2018-03-21 13:27:20 +00:00
services.prosody = {
enable = true;
# TODO: use a self-signed certificate
c2sRequireEncryption = false;
extraConfig = ''
storage = "sql"
'';
virtualHosts.test = {
domain = "example.com";
enabled = true;
};
2018-03-21 13:27:20 +00:00
};
environment.systemPackages = [
(pkgs.callPackage ./xmpp-sendmessage.nix {})
];
2018-03-21 13:27:20 +00:00
};
testScript = ''
$machine->waitForUnit('prosody.service');
$machine->succeed('prosodyctl status') =~ /Prosody is running/;
# set password to 'nothunter2' (it's asked twice)
$machine->succeed('yes nothunter2 | prosodyctl adduser cthon98@example.com');
2018-03-21 13:27:20 +00:00
# set password to 'y'
$machine->succeed('yes | prosodyctl adduser azurediamond@example.com');
# correct password to 'hunter2'
$machine->succeed('yes hunter2 | prosodyctl passwd azurediamond@example.com');
2018-03-21 13:27:20 +00:00
$machine->succeed("send-message");
$machine->succeed('prosodyctl deluser cthon98@example.com');
$machine->succeed('prosodyctl deluser azurediamond@example.com');
2018-03-21 13:27:20 +00:00
'';
}