def test_uninstall_before_install(self): """ Test uninstall without installing """ with pytest.raises( StateCheckError, message='Uninstall before install should raise an error'): zrobot = Zrobot('zrobot', data=self.valid_data) zrobot.uninstall()
def test_uninstall(self): zrobot = Zrobot('zrobot', data=self.valid_data) container = MagicMock() zrobot.api.services.get = MagicMock(return_value=container) patch('js9.j.clients.zos.sal.get_zerorobot', MagicMock()).start() zrobot.state.set('actions', 'install', 'ok') zrobot.state.delete = MagicMock(return_value=True) zrobot.uninstall() zrobot.state.delete.assert_called_with('status', 'running') container.schedule_action.assert_called_once_with('uninstall') container.delete.assert_called_once_with()