def testGetPlatformAutoLoadRecipes(self): pd = proddef.ProductDefinition() handle = conaryfacadetest.MockHandle() handle.product = pd handle.facade = mock.MockObject() handle.getConfig().user = ('JeanValjean', 'password') productStore = mock.MockInstance(dirstore.CheckoutProductStore) productStore._mock.enableMethod('getPlatformAutoLoadRecipes') productStore._mock.set(_handle=handle) facade = conaryfacade.ConaryFacade(handle) repos = conaryfacadetest.MockRepositoryClient() self.mock(facade, '_getRepositoryClient', lambda: repos) handle.facade._mock.set(conary=facade) alr = productStore.getPlatformAutoLoadRecipes() self.assertEquals(alr, []) alRecipes = ['foo', 'bar'] for troveName in alRecipes: pd.addPlatformAutoLoadRecipe(troveName) pkg1 = self.makeTroveTuple('foo=/foo.rpath.com@foo:2/2-2-2') groupTup1 = self.makeTroveTuple('group-foo=/foo.rpath.com@foo:1/1-1-1') groupTrv1 = mock.MockObject(stableReturnValues=True) groupTrv1.iterTroveList._mock.setDefaultReturn([pkg1]) self.mock(repos, 'getTroves', lambda *args, **kwargs: [groupTrv1]) pd.addSearchPath(groupTup1[0], label=str(groupTup1[1].branch()), version=str(groupTup1[1].trailingRevision())) alr = productStore.getPlatformAutoLoadRecipes() self.assertEquals(alr, ['foo=/foo.rpath.com@foo:2/2-2-2'])
def __init__(self, serverUrl=None): self.serverUrl = serverUrl self._cfg = None self.facade = Facade() self.facade.conary = conaryfacade.ConaryFacade(self) self.productStore = mock.MockObject() self.product = mock.MockObject() self.ui = mock.MockObject()
def getFacade(self, handle): return conaryfacade.ConaryFacade(handle)