コード例 #1
0
ファイル: postfix_test.py プロジェクト: DaveQB/salt
    def test_delete(self):
        '''
        Test for delete message(s) from the mail queue
        '''
        with patch.object(postfix, 'show_queue', return_value={}):
            self.assertDictEqual(postfix.delete('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.delete('ALL'),
                                 {'result': True, 'message':
                                  'Successfully removed all messages'})
コード例 #2
0
def test_delete():
    """
    Test for delete message(s) from the mail queue
    """
    with patch.object(postfix, "show_queue", return_value={}):
        assert postfix.delete("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.delete("ALL") == {
            "result": True,
            "message": "Successfully removed all messages",
        }
コード例 #3
0
    def test_delete(self):
        '''
        Test for delete message(s) from the mail queue
        '''
        with patch.object(postfix, 'show_queue', return_value={}):
            self.assertDictEqual(
                postfix.delete('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.delete('ALL'), {
                'result': True,
                'message': 'Successfully removed all messages'
            })