def test_rotate(self):
        with patch.dict(logadm.__salt__,
                        {'cmd.run_all':
                         MagicMock(return_value={'retcode': 1,
                                                 'stderr': 'stderr'})}):
            self.assertEqual(logadm.rotate('name'),
                             {'Output': 'stderr',
                              'Error': 'Failed in adding log'})

        with patch.dict(logadm.__salt__,
                        {'cmd.run_all':
                         MagicMock(return_value={'retcode': 0,
                                                 'stderr': 'stderr'})}):
            self.assertEqual(logadm.rotate('name'), {'Result': 'Success'})
Test for Set up pattern for logging.
dataset/ETHPy150Open saltstack/salt/tests/unit/modules/logadm_test.py/LogadmTestCase.test_rotate