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


Python BuildsLogic.get_multiple方法代码示例

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


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

示例1: test_build_collection_ok

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import get_multiple [as 别名]
    def test_build_collection_ok(self, f_users, f_coprs, f_builds, f_db,
                           f_users_api, f_mock_chroots):

        href = "/api_2/builds"
        self.db.session.commit()
        r = self.tc.get(href)
        assert r.status_code == 200
        obj = json.loads(r.data.decode("utf-8"))

        # not a pure test, but we test API here
        builds = BuildsLogic.get_multiple().all()
        expected_ids = set([b.id for b in builds])

        assert expected_ids == self.extract_build_ids(obj)
开发者ID:danvratil,项目名称:copr,代码行数:16,代码来源:test_build_r.py

示例2: test_build_collection_by_project_id

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import get_multiple [as 别名]
    def test_build_collection_by_project_id(
            self, f_users, f_mock_chroots, f_coprs,  f_builds, f_db):

        project_id_list = [copr.id for copr in self.basic_coprs_list]
        for id_ in project_id_list:
            href = "/api_2/builds?project_id={}".format(id_)
            self.db.session.commit()
            r = self.tc.get(href)
            assert r.status_code == 200
            obj = json.loads(r.data.decode("utf-8"))

            # not a pure test, but we test API here
            builds = [
                b for b in BuildsLogic.get_multiple().all()
                if b.copr.id == id_
            ]
            expected_ids = set([b.id for b in builds])
            assert expected_ids == self.extract_build_ids(obj)
开发者ID:danvratil,项目名称:copr,代码行数:20,代码来源:test_build_r.py

示例3: test_build_collection_by_owner

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import get_multiple [as 别名]
    def test_build_collection_by_owner(self, f_users, f_coprs, f_builds, f_db,
                           f_users_api, f_mock_chroots):

        names_list = [user.username for user in self.basic_user_list]
        for user_name in names_list:
            href = "/api_2/builds?owner={}".format(user_name)
            self.db.session.commit()
            r = self.tc.get(href)
            assert r.status_code == 200
            obj = json.loads(r.data.decode("utf-8"))

            # not a pure test, but we test API here
            builds = [
                b for b in BuildsLogic.get_multiple().all()
                if b.copr.owner.username == user_name
            ]
            expected_ids = set([b.id for b in builds])
            assert expected_ids == self.extract_build_ids(obj)
开发者ID:danvratil,项目名称:copr,代码行数:20,代码来源:test_build_r.py

示例4: test_build_collection_ok_finished

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import get_multiple [as 别名]
    def test_build_collection_ok_finished(
            self, f_users, f_coprs, f_mock_chroots,  f_builds, f_db):

        self.db.session.commit()

        href_a = "/api_2/builds?is_finished=True"
        href_b = "/api_2/builds?is_finished=False"

        r_a = self.tc.get(href_a)
        r_b = self.tc.get(href_b)

        assert r_a.status_code == 200
        assert r_b.status_code == 200
        obj_a = json.loads(r_a.data.decode("utf-8"))
        obj_b = json.loads(r_b.data.decode("utf-8"))

        builds = BuildsLogic.get_multiple().all()
        expected_ids_a = set([b.id for b in builds if b.max_ended_on is not None])
        expected_ids_b = set([b.id for b in builds if b.max_ended_on is None])

        assert expected_ids_a == self.extract_build_ids(obj_a)
        assert expected_ids_b == self.extract_build_ids(obj_b)
开发者ID:danvratil,项目名称:copr,代码行数:24,代码来源:test_build_r.py

示例5: test_build_collection_limit_offset

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import get_multiple [as 别名]
    def test_build_collection_limit_offset(
            self, f_users, f_mock_chroots, f_coprs, f_builds, f_db):

        self.db.session.commit()
        builds = BuildsLogic.get_multiple().all()
        total = len(builds)

        # test limit
        for lim in range(1, total + 1):
            href = "/api_2/builds?limit={}".format(lim)
            r = self.tc.get(href)
            assert r.status_code == 200
            obj = json.loads(r.data.decode("utf-8"))
            builds = obj["builds"]
            assert len(builds) == lim

            if lim > 2:
                delta = int(math.floor(lim / 2))
                href1 = "/api_2/builds?limit={}".format(delta)
                href2 = "/api_2/builds?limit={0}&offset={0}".format(delta)

                r1 = self.tc.get(href1)
                r2 = self.tc.get(href2)

                assert r1.status_code == 200
                assert r2.status_code == 200

                obj1 = json.loads(r1.data.decode("utf-8"))
                obj2 = json.loads(r2.data.decode("utf-8"))

                assert builds[:delta] == obj1["builds"]
                assert builds[delta:2 * delta] == obj2["builds"]

        # for coverage
        href = "/api_2/builds?limit={}".format(1000000)
        r = self.tc.get(href)
        assert r.status_code == 200
开发者ID:danvratil,项目名称:copr,代码行数:39,代码来源:test_build_r.py


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