# -*- 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'")