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