def test_stop(self): ''' Test for Stop the specified service ''' with patch.object(launchctl, '_service_by_name', return_value={'file_path': 'A'}): with patch.dict(launchctl.__salt__, {'cmd.retcode': MagicMock(return_value=False)}): self.assertTrue(launchctl.stop('job_label')) with patch.object(launchctl, '_service_by_name', return_value=None): self.assertFalse(launchctl.stop('job_label'))