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'})
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", }
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' })