Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
3.8

- name: Install Python dependencies
run: sudo pip install pytest miltertest dkimpy[ARC]
run: sudo pip install pytest miltertest inline_snapshot dkimpy[ARC] dirty_equals

- name: Build OpenARC
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ stamp-h1
*~
*.cache
*#*
.venv
.vscode

# compilation artifacts
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
### Added

### Changed
* tests - migrated from manual "snapshots" to `inline-snapshot`.

### Fixed

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ Tests can be run with `make check`. OpenARC's test suite requires:

* Python >= 3.8
* [pytest](https://pytest.org)
* [dirty-equals](https://github.com/samuelcolvin/dirty-equals)
* [inline-snapshot](https://15r10nk.github.io/inline-snapshot/)
* The Python [miltertest](https://pypi.org/project/miltertest/) library

There are also optional test dependencies whose associated tests will be
Expand Down
38 changes: 28 additions & 10 deletions test/test_interop.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

import pytest

from dirty_equals import IsStr
from inline_snapshot import snapshot

HAS_DKIMPY = True
try:
from dkim import ARC
Expand Down Expand Up @@ -46,11 +49,17 @@ def test_dkimpy_sign(run_miltertest, private_key, dkimpy):
]
res = run_miltertest(hdrs, False)

assert res['headers'][0] == ['Authentication-Results', ' example.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1']
assert res['headers'][1][0] == 'ARC-Seal'
assert 'cv=pass' in res['headers'][1][1]
assert res['headers'][2][0] == 'ARC-Message-Signature'
assert res['headers'][3] == ['ARC-Authentication-Results', ' i=2; example.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1']
assert res['headers'] == snapshot(
[
['Authentication-Results', ' example.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1'],
['ARC-Seal', IsStr(regex=r' i=2; d=example\.com; s=elpmaxe; a=rsa-sha256; cv=pass; t=1234567890;\s+(?s:.+)')],
[
'ARC-Message-Signature',
IsStr(regex=r' i=2; d=example\.com; s=elpmaxe; a=rsa-sha256;\s+c=relaxed/simple; t=1234567890;\s+h=Subject:From:To;\s+(?s:.+)'),
],
['ARC-Authentication-Results', ' i=2; example.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1'],
]
)


def test_dkimpy_verify(run_miltertest, private_key, dkimpy):
Expand Down Expand Up @@ -108,8 +117,17 @@ def test_perl_sign(run_miltertest, private_key, perl_mail_dkim):
]

res = run_miltertest(hdrs, False)
assert res['headers'][0] == ['Authentication-Results', ' example.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1']
assert res['headers'][1][0] == 'ARC-Seal'
assert 'cv=pass' in res['headers'][1][1]
assert res['headers'][2][0] == 'ARC-Message-Signature'
assert res['headers'][3] == ['ARC-Authentication-Results', ' i=2; example.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1']
assert res['headers'] == snapshot(
[
['Authentication-Results', ' example.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1'],
[
'ARC-Seal',
IsStr(regex=r' i=2; d=example.com; s=elpmaxe; a=rsa-sha256; cv=pass; t=1234567890;\s+(?s:.+)'),
],
[
'ARC-Message-Signature',
IsStr(regex=r' i=2; d=example.com; s=elpmaxe; a=rsa-sha256;\s+c=relaxed/simple; t=1234567890;\s+h=Subject:From:To;\s+(?s:.+)'),
],
['ARC-Authentication-Results', ' i=2; example.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1'],
]
)
Loading
Loading