1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-12 12:01:08 +01:00
home-manager/tests/modules/services/pizauth/basic-config.nix
Anton Tetov 99a69bdf8a pizauth: reload on change and option type
- added onChange pizauth reload for config file

- clientSecret is not required for outlook365 so should be nullable.
2025-08-30 13:53:07 -05:00

83 lines
2.1 KiB
Nix

{ pkgs, ... }:
{
config = {
services.pizauth = {
enable = true;
extraConfig = ''
refresh_at_least = 15s;
'';
accounts = {
test1 = {
authUri = "authUri1";
tokenUri = "tokenUri1";
clientId = "clientId1";
clientSecret = "clientSecret1";
loginHint = "testLogin1";
extraConfig = ''
redirectUri = "redirectUri1";
refresh_retry = 30s;
'';
};
test2 = {
authUri = "authUri2";
tokenUri = "tokenUri2";
clientId = "clientId2";
clientSecret = "clientSecret2";
scopes = [
"scope1"
"offline_access"
];
};
test3 = {
authUri = "authUri3";
tokenUri = "tokenUri3";
clientId = "clientId3";
scopes = [
];
};
};
};
test.stubs.pizauth = { };
nmt.script = ''
local serviceFile=home-files/.config/systemd/user/pizauth.service
assertFileExists $serviceFile
assertFileRegex $serviceFile 'ExecStart=.*/bin/dummy server -vvvv -d'
assertFileExists home-files/.config/pizauth.conf
assertFileContent home-files/.config/pizauth.conf \
${pkgs.writeText "expected-config" ''
refresh_at_least = 15s;
account "test1" {
auth_uri = "authUri1";
token_uri = "tokenUri1";
client_id = "clientId1";
client_secret = "clientSecret1";
login_hint = "testLogin1";
redirectUri = "redirectUri1";
refresh_retry = 30s;
}
account "test2" {
auth_uri = "authUri2";
token_uri = "tokenUri2";
client_id = "clientId2";
client_secret = "clientSecret2";
scopes = [
"scope1",
"offline_access"
];
}
account "test3" {
auth_uri = "authUri3";
token_uri = "tokenUri3";
client_id = "clientId3";
}
''}
'';
};
}