示例#1
0
    def testCheckoutBinaryPackage(self):
        _, facade = self.prep()
        mock.mock(facade, '_getVersion')
        mock.mock(facade, '_getFlavor')
        mockConaryCfg = mock.MockObject()
        mockConaryCfg._mock.enable('root')
        mock.mockMethod(facade.getConaryConfig)
        facade.getConaryConfig._mock.setDefaultReturn(mockConaryCfg)

        # Pin callback object
        callback = conaryfacade._QuietUpdateCallback()
        self.mock(conaryfacade, '_QuietUpdateCallback', lambda: callback)

        # quiet
        savedArgs = []
        doUpdateFn = lambda *args, **kwargs: mockedFunction(None, savedArgs,
                                                        None, *args, **kwargs)
        self.mock(updatecmd, 'doUpdate', doUpdateFn)
        facade.checkoutBinaryPackage('packageName', 'packageVersion',
            'packageFlavor', 'targetDir')
        self.assertEquals(mockConaryCfg.root, 'targetDir')
        self.assertEquals(savedArgs, [
            ((mockConaryCfg, 'packageName=packageVersion[packageFlavor]'),
                {'tagScript': None, 'callback': callback, 'depCheck': False})
        ])

        # noisy
        savedArgs = []
        facade.checkoutBinaryPackage('packageName', 'packageVersion',
            'packageFlavor', 'targetDir', quiet=False)
        self.assertEquals(savedArgs, [
            ((mockConaryCfg, 'packageName=packageVersion[packageFlavor]'),
                {'tagScript': None, 'callback': None, 'depCheck': False})
        ])
示例#2
0
    def testCheckoutBinaryPackage(self):
        _, facade = self.prep()
        mock.mock(facade, '_getVersion')
        mock.mock(facade, '_getFlavor')
        mockConaryCfg = mock.MockObject()
        mockConaryCfg._mock.enable('root')
        mock.mockMethod(facade.getConaryConfig)
        facade.getConaryConfig._mock.setDefaultReturn(mockConaryCfg)

        # Pin callback object
        callback = conaryfacade._QuietUpdateCallback()
        self.mock(conaryfacade, '_QuietUpdateCallback', lambda: callback)

        # quiet
        savedArgs = []
        doUpdateFn = lambda *args, **kwargs: mockedFunction(
            None, savedArgs, None, *args, **kwargs)
        self.mock(updatecmd, 'doUpdate', doUpdateFn)
        facade.checkoutBinaryPackage('packageName', 'packageVersion',
                                     'packageFlavor', 'targetDir')
        self.assertEquals(mockConaryCfg.root, 'targetDir')
        self.assertEquals(
            savedArgs,
            [((mockConaryCfg, 'packageName=packageVersion[packageFlavor]'), {
                'tagScript': None,
                'callback': callback,
                'depCheck': False
            })])

        # noisy
        savedArgs = []
        facade.checkoutBinaryPackage('packageName',
                                     'packageVersion',
                                     'packageFlavor',
                                     'targetDir',
                                     quiet=False)
        self.assertEquals(
            savedArgs,
            [((mockConaryCfg, 'packageName=packageVersion[packageFlavor]'), {
                'tagScript': None,
                'callback': None,
                'depCheck': False
            })])
示例#3
0
 def testQuietUpdateCallback(self):
     callback = conaryfacade._QuietUpdateCallback()
     callback.setUpdateJob()
示例#4
0
 def testQuietUpdateCallback(self):
     callback = conaryfacade._QuietUpdateCallback()
     callback.setUpdateJob()