def create_siderepo(workdir, arch, nvr, bid): worker_real=Worker('') # get the stubs worker_real.prep_siderepo = MagicMock(return_value = ' __str__') worker_real.get_nvr = MagicMock(return_value = []) rpms_nvr = [] if nvr: for rpm in nvr.split(';'): rpms_nvr.append(rpm) bids = [] if bid: for rpm in bid.split(';'): bids.extend(str(rpm)) rpms_bid = worker_real.get_nvr(bids, arch) rpms_nvr.extend(rpms_bid) # prepare side repository rpms = rpms_nvr if rpms: worker_real.prep_siderepo(workdir, rpms, arch) if bid: worker_real.get_nvr.assert_called_with(bids, arch) if rpms: worker_real.prep_siderepo.assert_called_with(workdir, rpms, arch) return
def delegation(iso_type): worker_real = Worker('') # get the stubs worker_real.build_bootiso = MagicMock(return_value = None) worker_real.build_dvd = MagicMock(return_value = None) worker_real.build_live = MagicMock(return_value = None) if iso_type == 'boot': worker_real.build_bootiso() worker_real.build_bootiso.assert_called_with() if iso_type == 'dvd': worker_real.build_dvd() worker_real.build_dvd.assert_called_with() if iso_type == 'boot': worker_real.build_live() worker_real.build_live.assert_called_with() return