feat: add basic postfix config helpers
This commit is contained in:
parent
a45a619cf3
commit
2a83142d95
4 changed files with 128 additions and 0 deletions
54
tests/test_postfix.py
Normal file
54
tests/test_postfix.py
Normal file
|
@ -0,0 +1,54 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
|
||||
from unittest import TestCase
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from wuttamess import postfix as mod
|
||||
|
||||
|
||||
class TestSetConfig(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
c = MagicMock()
|
||||
mod.set_config(c, 'foo', 'bar')
|
||||
c.run.assert_called_once_with("postconf -e 'foo=bar'")
|
||||
|
||||
|
||||
class TestSetMyhostname(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
c = MagicMock()
|
||||
mod.set_myhostname(c, 'test.example.com')
|
||||
c.run.assert_called_once_with("postconf -e 'myhostname=test.example.com'")
|
||||
|
||||
|
||||
class TestSetMyorigin(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
c = MagicMock()
|
||||
mod.set_myorigin(c, 'example.com')
|
||||
c.run.assert_called_once_with("postconf -e 'myorigin=example.com'")
|
||||
|
||||
|
||||
class TestSetMydestination(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
c = MagicMock()
|
||||
mod.set_mydestination(c, 'example.com', 'test.example.com', 'localhost')
|
||||
c.run.assert_called_once_with("postconf -e 'mydestination=example.com, test.example.com, localhost'")
|
||||
|
||||
|
||||
class TestSetMynetworks(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
c = MagicMock()
|
||||
mod.set_mynetworks(c, '127.0.0.0/8', '[::1]/128')
|
||||
c.run.assert_called_once_with("postconf -e 'mynetworks=127.0.0.0/8 [::1]/128'")
|
||||
|
||||
|
||||
class TestSetRelayhost(TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
c = MagicMock()
|
||||
mod.set_relayhost(c, 'mail.example.com')
|
||||
c.run.assert_called_once_with("postconf -e 'relayhost=mail.example.com'")
|
Loading…
Add table
Add a link
Reference in a new issue