[PATCH 3/5] gpg,tests: Add tests for the PGP trust model.

Justus Winter justus at g10code.com
Wed Jul 19 12:52:41 CEST 2017


Hi Damien :)

Let me be the first to say:  Very cool :D

Damien Goutte-Gattat <dgouttegattat at incenp.org> writes:

> diff --git a/tests/openpgp/trust-pgp.scm b/tests/openpgp/trust-pgp.scm
> new file mode 100644
> index 0000000..d83361b
> --- /dev/null
> +++ b/tests/openpgp/trust-pgp.scm
> @@ -0,0 +1,190 @@
> +#!/usr/bin/env gpgscm
> +
> +;; Copyright (C) 2017 g10 Code GmbH

That should be (c) by you.

> +(load (in-srcdir "tests" "openpgp" "defs.scm"))
> +(setup-environment)
> +
> +;; Redefine GPG without --always-trust.
> +(define GPG `(,(tool 'gpg)))

We should explicitly select the trust model here, because we may want to
change the default trust model in the future.

> +;; Reset the test environment. We do that kind of brutally,
> +;; by removing the pubring and trustdb files.
> +(define (reset-environment)
> +  (catch '() (unlink (path-join GNUPGHOME "pubring.kbx")))
> +  (catch '() (unlink (path-join GNUPGHOME "pubring.gpg")))
> +  (unlink (path-join GNUPGHOME "trustdb.gpg")))

Hehe >,< brutally, yes.  It also hard-codes a lot of knowledge about the
internal state of GnuPG.  Why not move the common definitions to a
separate file, and split this test into four?


Thanks,
Justus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: </pipermail/attachments/20170719/359c4573/attachment.sig>


More information about the Gnupg-devel mailing list