Skip to content

Commit

Permalink
mq_run_test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixSchwarz committed Jul 18, 2024
1 parent aae17f0 commit ace3791
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/mq_run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
# entries=() so the WorkingSet contains our entries only, nothing is
# picked up from the system
@mock.patch('schwarz.mailqueue.app_helpers._working_set', new=WorkingSet(entries=()))
def test_mq_runner_can_load_plugins(tmpdir):
queue_basedir = os.path.join(tmpdir, 'mailqueue')
def test_mq_runner_can_load_plugins(tmp_path):
queue_basedir = os.path.join(str(tmp_path), 'mailqueue')
create_maildir_directories(queue_basedir)
inject_example_message(queue_basedir)

mock_fn = mock.MagicMock(return_value=MQAction.DISCARD, spec={})
signal_map = {MQSignal.delivery_failed: mock_fn}
fake_plugin = create_fake_plugin(signal_map)
inject_plugin_into_working_set('testplugin', fake_plugin)
config_path = create_ini('host.example', port=12345, dir_path=tmpdir)
config_path = create_ini('host.example', port=12345, dir_path=str(tmp_path))

cmd = ['mq-run', config_path, queue_basedir]
mailer = DebugMailer(simulate_failed_sending=True)
Expand All @@ -46,11 +46,11 @@ def test_mq_runner_can_load_plugins(tmpdir):
assert len(tuple(find_messages(queue_basedir, log=l_(None)))) == 0, \
'plugin should have discarded the message after failed delivery'

def test_mq_runner_works_without_plugins(tmpdir):
queue_basedir = os.path.join(tmpdir, 'mailqueue')
def test_mq_runner_works_without_plugins(tmp_path):
queue_basedir = os.path.join(str(tmp_path), 'mailqueue')
create_maildir_directories(queue_basedir)
inject_example_message(queue_basedir)
config_path = create_ini('host.example', port=12345, dir_path=tmpdir)
config_path = create_ini('host.example', port=12345, dir_path=str(tmp_path))

cmd = ['mq-run', config_path, queue_basedir]
mailer = DebugMailer(simulate_failed_sending=True)
Expand Down

0 comments on commit ace3791

Please sign in to comment.