Ejemplo n.º 1
0
    def test_info_dpkg(self):
        # setup
        input_package = "package.deb"
        file_result = "debian"
        ver = '1.0'

        # common setup
        self.info_common_setup(input_package, file_result)

        # record
        package_info = {}
        package_info['type'] = 'dpkg'
        package_info['source'] = False
        os_dep.command.expect_call('dpkg')
        a_cmd = 'dpkg -f ' + input_package + ' Architecture 2>/dev/null'
        v_cmd = 'dpkg -f ' + input_package + ' Package 2>/dev/null'
        utils.system_output.expect_call(v_cmd).and_return(ver)
        i_cmd = 'dpkg -s ' + ver + ' 2>/dev/null'
        package_info['system_support'] = True
        utils.system_output.expect_call(v_cmd).and_return(ver)
        package_info['version'] = ver
        utils.system_output.expect_call(a_cmd).and_return('586')
        package_info['arch'] = '586'
        utils.system_output.expect_call(
            i_cmd, ignore_status=True).and_return('installed')
        package_info['installed'] = True

        # run and check
        info = package.info(input_package)
        self.god.check_playback()
        self.assertEquals(info, package_info)
Ejemplo n.º 2
0
    def test_info_dpkg(self):
        # setup
        input_package = "package.deb"
        file_result = "debian"
        ver = '1.0'

        # common setup
        self.info_common_setup(input_package, file_result)

        # record
        package_info = {}
        package_info['type'] = 'dpkg'
        package_info['source'] = False
        os_dep.command.expect_call('dpkg')
        a_cmd = 'dpkg -f ' + input_package + ' Architecture 2>/dev/null'
        v_cmd = 'dpkg -f ' + input_package + ' Package 2>/dev/null'
        utils.system_output.expect_call(v_cmd).and_return(ver)
        i_cmd = 'dpkg -s ' + ver + ' 2>/dev/null'
        package_info['system_support'] = True
        utils.system_output.expect_call(v_cmd).and_return(ver)
        package_info['version'] = ver
        utils.system_output.expect_call(a_cmd).and_return('586')
        package_info['arch'] = '586'
        utils.system_output.expect_call(i_cmd,
            ignore_status=True).and_return('installed')
        package_info['installed'] = True

        # run and check
        info = package.info(input_package)
        self.god.check_playback()
        self.assertEquals(info, package_info)
Ejemplo n.º 3
0
    def test_info_rpm(self):
        # setup
        input_package = "package.rpm"
        file_result = "rpm"
        ver = '1.0'

        # common setup
        self.info_common_setup(input_package, file_result)

        # record
        package_info = {}
        package_info['type'] = 'rpm'
        os_dep.command.expect_call('rpm')
        s_cmd = 'rpm -qp --qf %{SOURCE} ' + input_package + ' 2>/dev/null'
        a_cmd = 'rpm -qp --qf %{ARCH} ' + input_package + ' 2>/dev/null'
        v_cmd = 'rpm -qp ' + input_package + ' 2>/dev/null'

        utils.system_output.expect_call(v_cmd).and_return(ver)
        i_cmd = 'rpm -q ' + ver + ' 2>&1 >/dev/null'

        package_info['system_support'] = True
        utils.system_output.expect_call(s_cmd).and_return('source')
        package_info['source'] = True
        utils.system_output.expect_call(v_cmd).and_return(ver)
        package_info['version'] = ver
        utils.system_output.expect_call(a_cmd).and_return('586')
        package_info['arch'] = '586'
        utils.system.expect_call(i_cmd)
        package_info['installed'] = True

        # run and check
        info = package.info(input_package)
        self.god.check_playback()
        self.assertEquals(info, package_info)
Ejemplo n.º 4
0
    def test_info_rpm(self):
        # setup
        input_package = "package.rpm"
        file_result = "rpm"
        ver = '1.0'

        # common setup
        self.info_common_setup(input_package, file_result)

        # record
        package_info = {}
        package_info['type'] = 'rpm'
        os_dep.command.expect_call('rpm')
        s_cmd = 'rpm -qp --qf %{SOURCE} ' + input_package + ' 2>/dev/null'
        a_cmd = 'rpm -qp --qf %{ARCH} ' + input_package + ' 2>/dev/null'
        v_cmd = 'rpm -qp ' + input_package + ' 2>/dev/null'

        utils.system_output.expect_call(v_cmd).and_return(ver)
        i_cmd = 'rpm -q ' + ver + ' 2>&1 >/dev/null'

        package_info['system_support'] = True
        utils.system_output.expect_call(s_cmd).and_return('source')
        package_info['source'] = True
        utils.system_output.expect_call(v_cmd).and_return(ver)
        package_info['version'] = ver
        utils.system_output.expect_call(a_cmd).and_return('586')
        package_info['arch'] = '586'
        utils.system.expect_call(i_cmd)
        package_info['installed'] = True

        # run and check
        info = package.info(input_package)
        self.god.check_playback()
        self.assertEquals(info, package_info)