def test_rotate(self): ''' Test for Set up pattern for logging. ''' 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'})
def test_rotate(self): """ Test for Set up pattern for logging. """ 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"})
def test_rotate(self): ''' Test for Set up pattern for logging. ''' 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'})