From 5deb22a3a3870ce01c8ba01e8f7d09dd05d51f76 Mon Sep 17 00:00:00 2001
From: Sizhe Zhao <prc.zhao@outlook.com>
Date: Sun, 9 Jun 2024 16:11:36 +0800
Subject: [PATCH] git: update tests

---
 tests/modules/programs/gh/credential-helper.git.conf | 12 ++++++++++++
 tests/modules/programs/gh/credential-helper.nix      |  5 ++++-
 .../programs/git/git-with-email-expected.conf        | 12 ++++++++++++
 tests/modules/programs/git/git-with-email.nix        |  1 +
 .../programs/git/git-with-msmtp-expected.conf        | 12 ++++++++++++
 tests/modules/programs/git/git-with-msmtp.nix        |  1 +
 .../git/git-with-str-extra-config-expected.conf      | 12 ++++++++++++
 .../programs/git/git-with-str-extra-config.nix       |  1 +
 .../git/git-without-signing-key-id-expected.conf     |  3 +++
 .../programs/git/git-without-signing-key-id.nix      |  2 +-
 10 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/tests/modules/programs/gh/credential-helper.git.conf b/tests/modules/programs/gh/credential-helper.git.conf
index 529d6725a..8b712cd86 100644
--- a/tests/modules/programs/gh/credential-helper.git.conf
+++ b/tests/modules/programs/gh/credential-helper.git.conf
@@ -1,5 +1,17 @@
+[commit]
+	gpgSign = false
+
 [credential "https://github.com"]
 	helper = "@gh@/bin/gh auth git-credential"
 
 [credential "https://github.example.com"]
 	helper = "@gh@/bin/gh auth git-credential"
+
+[gpg]
+	format = "openpgp"
+
+[gpg "openpgp"]
+	program = "path-to-gpg"
+
+[tag]
+	gpgSign = false
diff --git a/tests/modules/programs/gh/credential-helper.nix b/tests/modules/programs/gh/credential-helper.nix
index 771572318..374d0b0a6 100644
--- a/tests/modules/programs/gh/credential-helper.nix
+++ b/tests/modules/programs/gh/credential-helper.nix
@@ -9,7 +9,10 @@
     };
   };
 
-  programs.git.enable = true;
+  programs.git = {
+    enable = true;
+    signing.signer = "path-to-gpg";
+  };
 
   test.stubs.gh = { };
 
diff --git a/tests/modules/programs/git/git-with-email-expected.conf b/tests/modules/programs/git/git-with-email-expected.conf
index fa027422f..d7c40973a 100644
--- a/tests/modules/programs/git/git-with-email-expected.conf
+++ b/tests/modules/programs/git/git-with-email-expected.conf
@@ -1,3 +1,12 @@
+[commit]
+	gpgSign = false
+
+[gpg]
+	format = "openpgp"
+
+[gpg "openpgp"]
+	program = "path-to-gpg"
+
 [sendemail "hm-account"]
 	from = "H. M. Test Jr. <hm@example.org>"
 	smtpEncryption = "tls"
@@ -12,6 +21,9 @@
 	smtpSslCertPath = "/etc/ssl/certs/ca-certificates.crt"
 	smtpUser = "home.manager"
 
+[tag]
+	gpgSign = false
+
 [user]
 	email = "hm@example.com"
 	name = "H. M. Test"
diff --git a/tests/modules/programs/git/git-with-email.nix b/tests/modules/programs/git/git-with-email.nix
index 0999eaa87..7135ce566 100644
--- a/tests/modules/programs/git/git-with-email.nix
+++ b/tests/modules/programs/git/git-with-email.nix
@@ -11,6 +11,7 @@ with lib;
     programs.git = {
       enable = true;
       package = pkgs.gitMinimal;
+      signing.signer = "path-to-gpg";
       userEmail = "hm@example.com";
       userName = "H. M. Test";
     };
diff --git a/tests/modules/programs/git/git-with-msmtp-expected.conf b/tests/modules/programs/git/git-with-msmtp-expected.conf
index 8cd5d86f0..8cf588c7a 100644
--- a/tests/modules/programs/git/git-with-msmtp-expected.conf
+++ b/tests/modules/programs/git/git-with-msmtp-expected.conf
@@ -1,3 +1,12 @@
+[commit]
+	gpgSign = false
+
+[gpg]
+	format = "openpgp"
+
+[gpg "openpgp"]
+	program = "path-to-gpg"
+
 [sendemail "hm-account"]
 	from = "H. M. Test Jr. <hm@example.org>"
 	smtpEncryption = "tls"
@@ -10,6 +19,9 @@
 	from = "H. M. Test <hm@example.com>"
 	smtpServer = "@msmtp@/bin/msmtp"
 
+[tag]
+	gpgSign = false
+
 [user]
 	email = "hm@example.com"
 	name = "H. M. Test"
diff --git a/tests/modules/programs/git/git-with-msmtp.nix b/tests/modules/programs/git/git-with-msmtp.nix
index 80e082c97..e444f659d 100644
--- a/tests/modules/programs/git/git-with-msmtp.nix
+++ b/tests/modules/programs/git/git-with-msmtp.nix
@@ -11,6 +11,7 @@ with lib;
     programs.git = {
       enable = true;
       package = pkgs.gitMinimal;
+      signing.signer = "path-to-gpg";
       userEmail = "hm@example.com";
       userName = "H. M. Test";
     };
diff --git a/tests/modules/programs/git/git-with-str-extra-config-expected.conf b/tests/modules/programs/git/git-with-str-extra-config-expected.conf
index 071268e83..2154bc580 100644
--- a/tests/modules/programs/git/git-with-str-extra-config-expected.conf
+++ b/tests/modules/programs/git/git-with-str-extra-config-expected.conf
@@ -1,5 +1,17 @@
 This can be anything.
 
+[commit]
+	gpgSign = false
+
+[gpg]
+	format = "openpgp"
+
+[gpg "openpgp"]
+	program = "path-to-gpg"
+
+[tag]
+	gpgSign = false
+
 [user]
 	email = "user@example.org"
 	name = "John Doe"
diff --git a/tests/modules/programs/git/git-with-str-extra-config.nix b/tests/modules/programs/git/git-with-str-extra-config.nix
index b2294c65b..b8bcb9508 100644
--- a/tests/modules/programs/git/git-with-str-extra-config.nix
+++ b/tests/modules/programs/git/git-with-str-extra-config.nix
@@ -7,6 +7,7 @@ with lib;
     programs.git = {
       enable = true;
       package = pkgs.gitMinimal;
+      signing.signer = "path-to-gpg";
       extraConfig = ''
         This can be anything.
       '';
diff --git a/tests/modules/programs/git/git-without-signing-key-id-expected.conf b/tests/modules/programs/git/git-without-signing-key-id-expected.conf
index 8c04aeda1..29452a2db 100644
--- a/tests/modules/programs/git/git-without-signing-key-id-expected.conf
+++ b/tests/modules/programs/git/git-without-signing-key-id-expected.conf
@@ -2,6 +2,9 @@
 	gpgSign = true
 
 [gpg]
+	format = "openpgp"
+
+[gpg "openpgp"]
 	program = "path-to-gpg"
 
 [tag]
diff --git a/tests/modules/programs/git/git-without-signing-key-id.nix b/tests/modules/programs/git/git-without-signing-key-id.nix
index 3428c40d7..f726f2fff 100644
--- a/tests/modules/programs/git/git-without-signing-key-id.nix
+++ b/tests/modules/programs/git/git-without-signing-key-id.nix
@@ -6,7 +6,7 @@
       userEmail = "user@example.org";
 
       signing = {
-        gpgPath = "path-to-gpg";
+        signer = "path-to-gpg";
         key = null;
         signByDefault = true;
       };