dkimpy-milter:dkg/test-suite

Last commit made on 2019-02-22
Get this branch:
git clone -b dkg/test-suite https://git.launchpad.net/dkimpy-milter
Members of dkimpy-milter-dev can upload to this branch. Log in for directions.

Branch merges

Branch information

Name:
dkg/test-suite
Repository:
lp:dkimpy-milter

Recent commits

ad8f396... by dkg on 2019-02-21

Expand test suite to cover RSA as well as ed25519

479820a... by dkg on 2019-02-19

tests: test DKIM signing and verification

This test makes use of DNSOverride and the new verifying milter to
ensure that signatures can be verified properly.

It doesn't test the actual interaction with the public DNS, but
getting that kind of test to work on arbitrary platforms might be more
trouble than it's worth.

I note that the DNSOverride only works as long as testkey.dns is a
single line, which is fine for ed25519, but maybe not for RSA.

7bfb87f... by dkg on 2019-02-19

Set up __main__.py, use it in tests

This allows us to invoke dkimpy-milter as "python -m dkimpy_milter
dkimpy-milter.conf", which makes running the test suite easier.

5c1d5d6... by dkg on 2019-02-19

tests: Run a verifying milter as well as a signing milter

Having a verifying milter will come in handy when we want to test both
sides of the DKIM process.

ae31730... by dkg on 2019-02-19

check for actions claimed by the filter

72ed000... by dkg on 2019-02-18

simple testing framework

b3db013... by dkg on 2019-02-19

config: Reassemble strings sensibly

If a string-based configuation entry had whitespace in it, it would be
reassembled via a round-trip through the python interpreter, resulting
in a line like this:

    PidFile /home/dkimpy-milter/pid file

produces a string like "['/home/dkimpy-milter/pid', 'file']", which is
clearly wrong.

I don't want to encourage people to use paths or other strings with
whitespace in them, but if we're going to fail on them we should be
failing explicitly, not doing a weird transformation that will just
break.

This is concretely useful for the DNSOverride mechanism, which is
where i ran into the problem when trying to set up testing that could
work without setting up an emulated DNS system.

bd1d25d... by dkg on 2019-02-19

Set up correct AuthservID defaults

Without this fix, a verifying dkimpy-milter that has no explicit
AuthservID produces the following crashing behavior as it tries to
create the authres header:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/Milter/__init__.py", line 772, in <lambda>
    milter.set_eom_callback(lambda ctx: ctx.getpriv().eom())
  File "…/dkimpy_milter/__init__.py", line 199, in eom
    h = fold(str(h))
  File "/usr/lib/python2.7/dist-packages/authres/core.py", line 476, in __str__
    return ''.join((self.HEADER_FIELD_NAME, ': ', self.header_value()))
  File "/usr/lib/python2.7/dist-packages/authres/core.py", line 496, in header_value
    return ''.join(strs)

1c60300... by dkg on 2019-02-19

add DNSOverride configuration for testing

71c0c3f... by dkg on 2019-02-21

Avoid failing to chown non-existent Unix-domain sockets

Changing ownership of sockets that doesn't exist isn't a great
practice.

A better approach would be to apply os.chown() to the file descriptor
of the open socket, but at the very least dkimpy-milter shouldn't
crash the way it currently does if the socket isn't already present.