Beispiel #1
0
    def test_requeue(self):
        '''
        Test for requeue message(s) in the mail queue
        '''
        with patch.object(postfix, 'show_queue', return_value={}):
            self.assertDictEqual(postfix.requeue('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.requeue('ALL'),
                                 {'result': True, 'message':
                                  'Successfully requeued all messages'})
Beispiel #2
0
def test_requeue():
    """
    Test for requeue message(s) in the mail queue
    """
    with patch.object(postfix, "show_queue", return_value={}):
        assert postfix.requeue("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.requeue("ALL") == {
            "result": True,
            "message": "Successfully requeued all messages",
        }
Beispiel #3
0
    def test_requeue(self):
        '''
        Test for requeue message(s) in the mail queue
        '''
        with patch.object(postfix, 'show_queue', return_value={}):
            self.assertDictEqual(
                postfix.requeue('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.requeue('ALL'), {
                    'result': True,
                    'message': 'Successfully requeued all messages'
                })