tests: add option test.stubs
This option provides a more convenient way to overlay dummy packages. It also adds a function `config.lib.test.mkStubPackage` that can, e.g., be used for `package` options.
This commit is contained in:
parent
b0651cc217
commit
cb09a968e9
159 changed files with 753 additions and 981 deletions
|
|
@ -1,4 +1,5 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (pkgs.stdenv.hostPlatform) isDarwin;
|
||||
|
||||
|
|
@ -7,13 +8,11 @@ let
|
|||
else
|
||||
".config/rbw/config.json";
|
||||
in {
|
||||
config = {
|
||||
programs.rbw.enable = true;
|
||||
imports = [ ./rbw-stubs.nix ];
|
||||
|
||||
nixpkgs.overlays = [ (import ./overlay.nix) ];
|
||||
programs.rbw.enable = true;
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/${path}
|
||||
'';
|
||||
};
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/${path}
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
self: super: {
|
||||
rbw = self.writeScriptBin "dummy-rbw" "";
|
||||
pinentry = {
|
||||
gnome3 = self.writeScriptBin "pinentry-gnome3" "" // {
|
||||
outPath = "@pinentry-gnome3@";
|
||||
};
|
||||
gtk2 = self.writeScriptBin "pinentry-gtk2" "" // {
|
||||
outPath = "@pinentry-gtk2@";
|
||||
};
|
||||
flavors = [ "gnome3" "gtk2" ];
|
||||
};
|
||||
}
|
||||
16
tests/modules/programs/rbw/rbw-stubs.nix
Normal file
16
tests/modules/programs/rbw/rbw-stubs.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
test.stubs.rbw = { };
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
pinentry = {
|
||||
gnome3 =
|
||||
config.lib.test.mkStubPackage { outPath = "@pinentry-gnome3@"; };
|
||||
gtk2 = config.lib.test.mkStubPackage { outPath = "@pinentry-gtk2@"; };
|
||||
flavors = [ "gnome3" "gtk2" ];
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (pkgs.stdenv.hostPlatform) isDarwin;
|
||||
|
||||
|
|
@ -17,23 +18,21 @@ let
|
|||
}
|
||||
'';
|
||||
in {
|
||||
config = {
|
||||
programs.rbw = {
|
||||
enable = true;
|
||||
settings = {
|
||||
email = "name@example.com";
|
||||
base_url = "bitwarden.example.com";
|
||||
identity_url = "identity.example.com";
|
||||
lock_timeout = 300;
|
||||
pinentry = "gnome3";
|
||||
};
|
||||
imports = [ ./rbw-stubs.nix ];
|
||||
|
||||
programs.rbw = {
|
||||
enable = true;
|
||||
settings = {
|
||||
email = "name@example.com";
|
||||
base_url = "bitwarden.example.com";
|
||||
identity_url = "identity.example.com";
|
||||
lock_timeout = 300;
|
||||
pinentry = "gnome3";
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [ (import ./overlay.nix) ];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/${path}
|
||||
assertFileContent home-files/${path} '${expected}'
|
||||
'';
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/${path}
|
||||
assertFileContent home-files/${path} '${expected}'
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (pkgs.stdenv.hostPlatform) isDarwin;
|
||||
|
||||
|
|
@ -17,17 +18,15 @@ let
|
|||
}
|
||||
'';
|
||||
in {
|
||||
config = {
|
||||
programs.rbw = {
|
||||
enable = true;
|
||||
settings = { email = "name@example.com"; };
|
||||
};
|
||||
imports = [ ./rbw-stubs.nix ];
|
||||
|
||||
nixpkgs.overlays = [ (import ./overlay.nix) ];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/${path}
|
||||
assertFileContent home-files/${path} '${expected}'
|
||||
'';
|
||||
programs.rbw = {
|
||||
enable = true;
|
||||
settings = { email = "name@example.com"; };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/${path}
|
||||
assertFileContent home-files/${path} '${expected}'
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue