Example #1
0
    def test_hold(self):
        '''
        Test for set held message(s) in the mail queue to unheld
        '''
        with patch.object(postfix, 'show_queue', return_value={}):
            self.assertDictEqual(postfix.hold('queue_id'),
                                 {'result': False, 'message':
                                  'No message in queue with ID queue_id'})

        with patch.dict(postfix.__salt__,
                        {'cmd.run_all':
                         MagicMock(return_value={'retcode': 0})}):
            self.assertDictEqual(postfix.hold('ALL'),
                                 {'result': True, 'message':
                                  'Successfully placed all messages on hold'})
Example #2
0
def test_hold():
    """
    Test for set held message(s) in the mail queue to unheld
    """
    with patch.object(postfix, "show_queue", return_value={}):
        assert postfix.hold("queue_id") == {
            "result": False,
            "message": "No message in queue with ID queue_id",
        }

    with patch.dict(postfix.__salt__,
                    {"cmd.run_all": MagicMock(return_value={"retcode": 0})}):
        assert postfix.hold("ALL") == {
            "result": True,
            "message": "Successfully placed all messages on hold",
        }
Example #3
0
    def test_hold(self):
        '''
        Test for set held message(s) in the mail queue to unheld
        '''
        with patch.object(postfix, 'show_queue', return_value={}):
            self.assertDictEqual(
                postfix.hold('queue_id'), {
                    'result': False,
                    'message': 'No message in queue with ID queue_id'
                })

        with patch.dict(
                postfix.__salt__,
            {'cmd.run_all': MagicMock(return_value={'retcode': 0})}):
            self.assertDictEqual(
                postfix.hold('ALL'), {
                    'result': True,
                    'message': 'Successfully placed all messages on hold'
                })