pizauth: init module
This commit is contained in:
parent
0b7147a547
commit
18ea6d7a8f
4 changed files with 274 additions and 0 deletions
70
tests/modules/services/pizauth/basic-config.nix
Normal file
70
tests/modules/services/pizauth/basic-config.nix
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
{ 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"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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"
|
||||
];
|
||||
}
|
||||
''}
|
||||
'';
|
||||
};
|
||||
}
|
||||
2
tests/modules/services/pizauth/default.nix
Normal file
2
tests/modules/services/pizauth/default.nix
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
{ lib, pkgs, ... }:
|
||||
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux { pizauth-basic-config = ./basic-config.nix; }
|
||||
Loading…
Add table
Add a link
Reference in a new issue