当前位置: 首页>>代码示例>>Python>>正文


Python StagingAPI.get_package_for_request_id方法代码示例

本文整理汇总了Python中osclib.stagingapi.StagingAPI.get_package_for_request_id方法的典型用法代码示例。如果您正苦于以下问题:Python StagingAPI.get_package_for_request_id方法的具体用法?Python StagingAPI.get_package_for_request_id怎么用?Python StagingAPI.get_package_for_request_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在osclib.stagingapi.StagingAPI的用法示例。


在下文中一共展示了StagingAPI.get_package_for_request_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestApiCalls

# 需要导入模块: from osclib.stagingapi import StagingAPI [as 别名]
# 或者: from osclib.stagingapi.StagingAPI import get_package_for_request_id [as 别名]

#.........这里部分代码省略.........
        requests = self.api.get_open_requests()

        # Compare the results, we only care now that we got 1 of them not the content
        self.assertEqual(1, len(requests))

    def test_get_package_information(self):
        """
        Test if we get proper project, name and revision from the staging informations
        """

        package_info = {
            'dir_srcmd5': '751efeae52d6c99de48164088a33d855',
            'project': 'home:Admin',
            'rev': '7b98ac01b8071d63a402fa99dc79331c',
            'srcmd5': '7b98ac01b8071d63a402fa99dc79331c',
            'package': 'wine'
        }

        # Compare the results, we only care now that we got 2 of them not the content
        self.assertEqual(
            package_info,
            self.api.get_package_information('openSUSE:Factory:Staging:B', 'wine'))

    def test_request_id_package_mapping(self):
        """
        Test whether we can get correct id for sr in staging project
        """

        prj = 'openSUSE:Factory:Staging:B'
        # Get rq
        num = self.api.get_request_id_for_package(prj, 'wine')
        self.assertEqual(333, num)
        # Get package name
        self.assertEqual('wine', self.api.get_package_for_request_id(prj, num))

    def test_rm_from_prj(self):
        prj = 'openSUSE:Factory:Staging:B'
        pkg = 'wine'

        full_name = prj + '/' + pkg

        # Verify package is there
        self.assertTrue(full_name in self.obs.links)

        # Get rq number
        num = self.api.get_request_id_for_package(prj, pkg)

        # Delete the package
        self.api.rm_from_prj(prj, package='wine')

        # Verify package is not there
        self.assertTrue(full_name not in self.obs.links)

        # RQ is gone
        self.assertEqual(None, self.api.get_request_id_for_package(prj, pkg))
        self.assertEqual(None, self.api.get_package_for_request_id(prj, num))

        # Verify that review is closed
        self.assertEqual('accepted', self.obs.requests[str(num)]['review'])
        self.assertEqual('new', self.obs.requests[str(num)]['request'])

    def test_rm_from_prj_2(self):
        # Try the same with request number
        prj = 'openSUSE:Factory:Staging:B'
        pkg = 'wine'
开发者ID:coogor,项目名称:osc-plugin-factory,代码行数:69,代码来源:api_tests.py

示例2: TestApiCalls

# 需要导入模块: from osclib.stagingapi import StagingAPI [as 别名]
# 或者: from osclib.stagingapi.StagingAPI import get_package_for_request_id [as 别名]

#.........这里部分代码省略.........

        # get the open requests
        requests = self.api.get_open_requests()

        # Compare the results, we only care now that we got 1 of them not the content
        self.assertEqual(1, len(requests))

    def test_get_package_information(self):
        """
        Test if we get proper project, name and revision from the staging informations
        """

        package_info = {
            "dir_srcmd5": "751efeae52d6c99de48164088a33d855",
            "project": "home:Admin",
            "rev": "7b98ac01b8071d63a402fa99dc79331c",
            "srcmd5": "7b98ac01b8071d63a402fa99dc79331c",
            "package": "wine",
        }

        # Compare the results, we only care now that we got 2 of them not the content
        self.assertEqual(package_info, self.api.get_package_information("openSUSE:Factory:Staging:B", "wine"))

    def test_request_id_package_mapping(self):
        """
        Test whether we can get correct id for sr in staging project
        """

        prj = "openSUSE:Factory:Staging:B"
        # Get rq
        num = self.api.get_request_id_for_package(prj, "wine")
        self.assertEqual(333, num)
        # Get package name
        self.assertEqual("wine", self.api.get_package_for_request_id(prj, num))

    def test_rm_from_prj(self):
        prj = "openSUSE:Factory:Staging:B"
        pkg = "wine"

        full_name = prj + "/" + pkg

        # Verify package is there
        self.assertTrue(full_name in self.obs.links)

        # Get rq number
        num = self.api.get_request_id_for_package(prj, pkg)

        # Delete the package
        self.api.rm_from_prj(prj, package="wine")

        # Verify package is not there
        self.assertTrue(full_name not in self.obs.links)

        # RQ is gone
        self.assertEqual(None, self.api.get_request_id_for_package(prj, pkg))
        self.assertEqual(None, self.api.get_package_for_request_id(prj, num))

        # Verify that review is closed
        self.assertEqual("accepted", self.obs.requests[str(num)]["review"])
        self.assertEqual("new", self.obs.requests[str(num)]["request"])

    def test_rm_from_prj_2(self):
        # Try the same with request number
        prj = "openSUSE:Factory:Staging:B"
        pkg = "wine"
开发者ID:bluca,项目名称:osc-plugin-factory,代码行数:69,代码来源:api_tests.py


注:本文中的osclib.stagingapi.StagingAPI.get_package_for_request_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。