fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Robert Helgessongit: stub test dependency on msmtp78afc2fa

master
1.2 KiB42 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5{
6  imports = [ ../../accounts/email-test-accounts.nix ];
7
8  config = {
9    accounts.email.accounts."hm@example.com".msmtp.enable = true;
10    programs.git = {
11      enable = true;
12      package = pkgs.gitMinimal;
13      userEmail = "hm@example.com";
14      userName = "H. M. Test";
15    };
16
17    home.stateVersion = "20.09";
18
19    test.stubs.msmtp = { };
20
21    nmt.script = ''
22      function assertGitConfig() {
23        local value
24        value=$(${pkgs.gitMinimal}/bin/git config \
25          --file $TESTED/home-files/.config/git/config \
26          --get $1)
27        if [[ $value != $2 ]]; then
28          fail "Expected option '$1' to have value '$2' but it was '$value'"
29        fi
30      }
31
32      assertFileExists home-files/.config/git/config
33      assertFileContent home-files/.config/git/config \
34        ${./git-with-msmtp-expected.conf}
35
36      assertGitConfig "sendemail.hm@example.com.from" "hm@example.com"
37      assertGitConfig "sendemail.hm-account.from" "hm@example.org"
38      assertGitConfig "sendemail.hm@example.com.smtpServer" "${pkgs.msmtp}/bin/msmtp"
39      assertGitConfig "sendemail.hm@example.com.envelopeSender" "auto"
40    '';
41  };
42}