diff options
| author | Mark Sapiro | 2017-04-22 15:39:13 -0700 |
|---|---|---|
| committer | Mark Sapiro | 2017-04-22 15:39:13 -0700 |
| commit | 9b7a47dbf92abf9bf6e4226ad4fe7da470c8da5f (patch) | |
| tree | 9d2248f730e98742c65ff07a7fe85ec85e2e5d9c /src/mailman/core/tests/test_switchboard.py | |
| parent | 23be50d1555977438e295ab219109ee1d934d14a (diff) | |
| download | mailman-9b7a47dbf92abf9bf6e4226ad4fe7da470c8da5f.tar.gz mailman-9b7a47dbf92abf9bf6e4226ad4fe7da470c8da5f.tar.zst mailman-9b7a47dbf92abf9bf6e4226ad4fe7da470c8da5f.zip | |
Diffstat (limited to 'src/mailman/core/tests/test_switchboard.py')
| -rw-r--r-- | src/mailman/core/tests/test_switchboard.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mailman/core/tests/test_switchboard.py b/src/mailman/core/tests/test_switchboard.py index 5303abb9b..7fe527ee1 100644 --- a/src/mailman/core/tests/test_switchboard.py +++ b/src/mailman/core/tests/test_switchboard.py @@ -17,6 +17,7 @@ """Switchboard tests.""" +import os import unittest from mailman.config import config @@ -51,3 +52,22 @@ Message-ID: <ant> traceback = error_log.read().splitlines() self.assertEqual(traceback[1], 'Traceback (most recent call last):') self.assertEqual(traceback[-1], 'OSError: Oops!') + + def test_no_bak_but_pck(self): + # if there is no .bak file but a .pck with the same filebase, + # .finish() should handle the .pck. + msg = mfs("""\ +From: anne@example.com +To: test@example.com +Message-ID: <ant> + +""") + switchboard = config.switchboards['shunt'] + # Enqueue the message. + filebase = switchboard.enqueue(msg) + # Now call .finish() without first dequeueing. + switchboard.finish(filebase, preserve=True) + # And ensure the file got preserved. + bad_dir = config.switchboards['bad'].queue_directory + psvfile = os.path.join(bad_dir, filebase + '.psv') + self.assertTrue(os.path.isfile(psvfile)) |
