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


Python factories.BuildFactory类代码示例

本文整理汇总了Python中jenkins.tests.factories.BuildFactory的典型用法代码示例。如果您正苦于以下问题:Python BuildFactory类的具体用法?Python BuildFactory怎么用?Python BuildFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: test_archive_build_projectbuild

    def test_archive_build_projectbuild(self):
        """
        The archiver can handle archiving a build from a projectbuild.
        """
        project, dependency1, dependency2 = self.create_dependencies(2)

        ProjectDependency.objects.create(
            project=project, dependency=dependency2)
        projectbuild = build_project(project, queue_build=False)

        archive = ArchiveFactory.create(policy="cdimage")

        build1 = BuildFactory.create(
            job=dependency1.job, build_id=projectbuild.build_key)
        artifact1 = ArtifactFactory.create(
            build=build1, filename="artifact1.gz")

        update_projectbuilds(build1)
        build1_items = archive.add_build(build1)
        self.assertEqual(2, len(build1_items[artifact1]))

        build2 = BuildFactory.create(
            job=dependency2.job, build_id=projectbuild.build_key)
        artifact2 = ArtifactFactory.create(build=build2, filename="artifact2.gz")

        update_projectbuilds(build2)
        build2_items = archive.add_build(build2)
        self.assertEqual(2, len(build2_items[artifact2]))

        self.assertEqual(4, archive.items.count())

        self.assertEqual(
            2,
            ArchiveArtifact.objects.filter(
                projectbuild_dependency__projectbuild=projectbuild).count())
开发者ID:devton,项目名称:capomastro,代码行数:35,代码来源:test_models.py

示例2: test_auto_track_dependency_triggers_project_build_creation

    def test_auto_track_dependency_triggers_project_build_creation(self):
        """
        If we record a build of a project dependency that is auto-tracked,
        then this should trigger the creation of a new ProjectBuild for that
        project.
        """
        dependency1 = DependencyFactory.create()
        ProjectDependency.objects.create(project=self.project, dependency=dependency1)

        dependency2 = DependencyFactory.create()
        existing_build = BuildFactory.create(job=dependency2.job, phase="FINISHED")
        ProjectDependency.objects.create(project=self.project, dependency=dependency2, current_build=existing_build)

        self.assertEqual(0, ProjectBuild.objects.filter(project=self.project).count())

        build = BuildFactory.create(job=dependency1.job, phase="FINISHED")
        process_build_dependencies(build.pk)

        self.assertEqual(1, ProjectBuild.objects.filter(project=self.project).count())

        projectbuild = ProjectBuild.objects.get(project=self.project)
        self.assertEqual(2, ProjectBuildDependency.objects.filter(projectbuild=projectbuild).count())
        build_dependency1 = ProjectBuildDependency.objects.get(projectbuild=projectbuild, dependency=dependency1)
        self.assertEqual(build, build_dependency1.build)

        build_dependency2 = ProjectBuildDependency.objects.get(projectbuild=projectbuild, dependency=dependency2)
        self.assertEqual(existing_build, build_dependency2.build)
开发者ID:notnownikki,项目名称:capomastro,代码行数:27,代码来源:test_tasks.py

示例3: test_dependency_build_pagination

    def test_dependency_build_pagination(self):
        """
        The dependency build list should return maximum number records as
        defined in PAGINATE_BUILDS. The previous page link should be
        disabled and the next page link should be available.
        """
        dependency = DependencyFactory.create()
        BuildFactory.create_batch(
            DependencyDetailView.PAGINATE_BUILDS + 1, job=dependency.job)

        depend_url = reverse("dependency_detail", kwargs={"pk": dependency.pk})
        response = self.app.get(depend_url, user="testing")
        self.assertEqual(200, response.status_code)
        self.assertEqual(len(response.context["builds"]),
                         DependencyDetailView.PAGINATE_BUILDS)
        self.assertEqual(response.context["builds"].number, 1)

        # Check that the 'Newer' link is disabled
        self.assertRaises(IndexError, response.click, "Newer")

        # Check that the 'Older' link takes us to page two
        older = response.click("Older")
        self.assertEqual(200, older.status_code)
        self.assertNotEquals(older, response)
        self.assertEqual(older.context["builds"].number, 2)
开发者ID:devton,项目名称:capomastro,代码行数:25,代码来源:test_views.py

示例4: test_project_build_detail_view

    def test_project_build_detail_view(self):
        """
        Project build detail should show the build.
        """
        dependency = DependencyFactory.create()
        ProjectDependency.objects.create(
            project=self.project, dependency=dependency)

        projectbuild = build_project(self.project, queue_build=False)
        BuildFactory.create(
            job=dependency.job, build_id=projectbuild.build_key)

        url = reverse(
            "project_projectbuild_detail",
            kwargs={"project_pk": self.project.pk,
                    "build_pk": projectbuild.pk})
        response = self.app.get(url, user="testing")

        dependencies = ProjectBuildDependency.objects.filter(
            projectbuild=projectbuild)

        self.assertEqual(projectbuild, response.context["projectbuild"])
        self.assertEqual(
            list(dependencies), list(response.context["dependencies"]))
        self.assertTrue(
            "archived_items" not in response.context,
            "Project Build has archive items.")
开发者ID:devton,项目名称:capomastro,代码行数:27,代码来源:test_views.py

示例5: test_build_project_automated_autotracked_dependencies

    def test_build_project_automated_autotracked_dependencies(self):
        """
        For autotracked dependencies, we should use the most recent
        projectbuild to find the builds for associating with the new
        projectbuild.
        """
        project = ProjectFactory.create()
        dependency1 = DependencyFactory.create()
        project_dep1 = ProjectDependency.objects.create(
            project=project, dependency=dependency1,
            current_build=BuildFactory.create())

        dependency2 = DependencyFactory.create()
        project_dep2 = ProjectDependency.objects.create(
            project=project, dependency=dependency2,
            current_build=BuildFactory.create())

        build1 = build_project(project, automated=True)

        # We store the current built dependency for dependency2 because we're
        # going to build dependency1.
        built_dependency1 = ProjectBuildDependency.objects.get(
            projectbuild=build1, dependency=dependency2)

        build2 = build_project(project, dependencies=[dependency1], automated=True)

        built_dependency2 = ProjectBuildDependency.objects.get(
            projectbuild=build2, dependency=dependency2)
        self.assertEqual(built_dependency2.build, built_dependency1.build)
开发者ID:bigkevmcd,项目名称:capomastro,代码行数:29,代码来源:test_helpers.py

示例6: test_get_build_table_with_current_build_outside_recent

    def test_get_build_table_with_current_build_outside_recent(self):
        """
        If we have a current build outside the most recent 5, then we should
        extend the dependencies list for that row to illustrate the current
        build.
        """
        project = ProjectFactory.create()
        dependency = DependencyFactory.create()

        build = BuildFactory.create(job=dependency.job)
        [build1, build2, build3, build4, build5] = BuildFactory.create_batch(
            5, job=dependency.job)
        ProjectDependency.objects.create(
            project=project, dependency=dependency, auto_track=False,
            current_build=build)

        header, table = get_build_table_for_project(project)

        self.assertEqual([dependency], header)
        self.assertEqual([
            [{"build": build5, "current": False}],
            [{"build": build4, "current": False}],
            [{"build": build3, "current": False}],
            [{"build": build2, "current": False}],
            [{"build": build1, "current": False}],
            [{"build": build, "current": True}]], table)
开发者ID:bigkevmcd,项目名称:capomastro,代码行数:26,代码来源:test_utils.py

示例7: test_build_project_automated_non_autotracked

    def test_build_project_automated_non_autotracked(self):
        """
        For automated, non-autotracked builds, each of the projectbuild
        dependencies created should use the current build of the dependency.
        """
        project = ProjectFactory.create()
        dependency1 = DependencyFactory.create()
        project_dep1 = ProjectDependency.objects.create(
            project=project, dependency=dependency1,
            current_build=BuildFactory.create())

        dependency2 = DependencyFactory.create()
        project_dep2 = ProjectDependency.objects.create(
            project=project, dependency=dependency2,
            current_build=BuildFactory.create())

        new_build = build_project(project, automated=True)

        build_dependencies = ProjectBuildDependency.objects.filter(
            projectbuild=new_build)
        self.assertEqual(2, build_dependencies.count())

        self.assertEqual(
            [dependency1, dependency2],
            [x.dependency for x in build_dependencies])

        self.assertEqual(
            [project_dep1.current_build, project_dep2.current_build],
            [x.build for x in build_dependencies])
开发者ID:bigkevmcd,项目名称:capomastro,代码行数:29,代码来源:test_helpers.py

示例8: test_get_build_table_for_project_with_multiple_dependencies

    def test_get_build_table_for_project_with_multiple_dependencies(self):
        """
        We should get a table of rows with all dependencies, indicating
        whether or not the current build is the build.
        """
        project = ProjectFactory.create()
        dependency1 = DependencyFactory.create()
        dependency2 = DependencyFactory.create()

        [build1, build2, build3, build4, build5] = BuildFactory.create_batch(
            5, job=dependency1.job)
        ProjectDependency.objects.create(
            project=project, dependency=dependency1, auto_track=False,
            current_build=build5)

        [build6, build7, build8, build9, build10] = BuildFactory.create_batch(
            5, job=dependency2.job)
        ProjectDependency.objects.create(
            project=project, dependency=dependency2, auto_track=False,
            current_build=build8)

        header, table = get_build_table_for_project(project)

        self.assertEqual([dependency1, dependency2], header)
        self.assertEqual([
            [{"build": build5, "current": True},
             {"build": build10, "current": False}],
            [{"build": build4, "current": False},
             {"build": build9, "current": False}],
            [{"build": build3, "current": False},
             {"build": build8, "current": True}],
            [{"build": build2, "current": False},
             {"build": build7, "current": False}],
            [{"build": build1, "current": False},
             {"build": build6, "current": False}]], table)
开发者ID:bigkevmcd,项目名称:capomastro,代码行数:35,代码来源:test_utils.py

示例9: test_archive_projectbuild_with_prearchived_artifact

    def test_archive_projectbuild_with_prearchived_artifact(self):
        """
        If we archive a project build with several artifacts, it should return
        only the newly added artifacts.
        """
        project = ProjectFactory.create()
        dependency1 = DependencyFactory.create()
        ProjectDependency.objects.create(
            project=project, dependency=dependency1)
        dependency2 = DependencyFactory.create()
        ProjectDependency.objects.create(
            project=project, dependency=dependency2)

        projectbuild = build_project(project, queue_build=False)

        build1 = BuildFactory.create(
            job=dependency1.job, build_id=projectbuild.build_key)
        build2 = BuildFactory.create(
            job=dependency2.job, build_id=projectbuild.build_key)

        ArtifactFactory.create(build=build1, filename="artifact1.gz")
        artifact = ArtifactFactory.create(
            build=build2, filename="artifact2.gz")
        archive = ArchiveFactory.create()

        archive.add_artifact(artifact, projectbuild=projectbuild)
        result = archive.archive_projectbuild(projectbuild)

        self.assertEqual(2, archive.items.count())
        self.assertEqual(1, len(result))
开发者ID:notnownikki,项目名称:capomastro,代码行数:30,代码来源:test_models.py

示例10: test_archive_projectbuild

    def test_archive_projectbuild(self):
        """
        The archiver can handle archiving an entire project build.
        """
        project = ProjectFactory.create()
        dependency1 = DependencyFactory.create()
        ProjectDependency.objects.create(
            project=project, dependency=dependency1)
        dependency2 = DependencyFactory.create()
        ProjectDependency.objects.create(
            project=project, dependency=dependency2)

        projectbuild = build_project(project, queue_build=False)

        build1 = BuildFactory.create(
            job=dependency1.job, build_id=projectbuild.build_key)
        build2 = BuildFactory.create(
            job=dependency2.job, build_id=projectbuild.build_key)

        ArtifactFactory.create(build=build1, filename="artifact1.gz")
        ArtifactFactory.create(build=build2, filename="artifact2.gz")

        archive = ArchiveFactory.create()

        result = archive.archive_projectbuild(projectbuild)

        self.assertEqual(2, archive.items.count())
        self.assertEqual(2, len(result))
开发者ID:notnownikki,项目名称:capomastro,代码行数:28,代码来源:test_models.py

示例11: test_project_build_sends_finished_signal

    def test_project_build_sends_finished_signal(self):
        """
        When we set the projectbuild status to finished, we should signal this.
        """
        @receiver(projectbuild_finished, sender=ProjectBuild)
        def handle_signal(sender, projectbuild, **kwargs):
            self.projectbuild = projectbuild

        project = ProjectFactory.create()
        dependency1 = DependencyFactory.create()
        ProjectDependency.objects.create(
            project=project, dependency=dependency1)

        dependency2 = DependencyFactory.create()
        ProjectDependency.objects.create(
            project=project, dependency=dependency2)

        from projects.helpers import build_project
        projectbuild = build_project(project, queue_build=False)

        for job in [dependency1.job, dependency2.job]:
            BuildFactory.create(
                job=job, build_id=projectbuild.build_id, phase="FINISHED")

        self.assertEqual(projectbuild, self.projectbuild)
开发者ID:timrchavez,项目名称:capomastro,代码行数:25,代码来源:test_models.py

示例12: test_project_build_status_when_all_dependencies_have_builds

    def test_project_build_status_when_all_dependencies_have_builds(self):
        """
        When we have FINISHED builds for all the dependencies, the projectbuild
        state should be FINISHED.
        """
        project = ProjectFactory.create()
        dependency1 = DependencyFactory.create()
        ProjectDependency.objects.create(
            project=project, dependency=dependency1)

        dependency2 = DependencyFactory.create()
        ProjectDependency.objects.create(
            project=project, dependency=dependency2)

        from projects.helpers import build_project
        projectbuild = build_project(project, queue_build=False)

        for job in [dependency1.job, dependency2.job]:
            BuildFactory.create(
                job=job, build_id=projectbuild.build_id, phase="FINISHED")

        projectbuild = ProjectBuild.objects.get(pk=projectbuild.pk)
        self.assertEqual("SUCCESS", projectbuild.status)
        self.assertEqual("FINISHED", projectbuild.phase)
        self.assertIsNotNone(projectbuild.ended_at)
开发者ID:timrchavez,项目名称:capomastro,代码行数:25,代码来源:test_models.py

示例13: test_get_current_build

 def test_get_current_build(self):
     """
     Dependency.get_current_build should return the most recent build that
     has completed and was SUCCESSful.
     """
     build1 = BuildFactory.create()
     build2 = BuildFactory.create(
         phase=Build.FINALIZED, status="SUCCESS", job=build1.job)
     dependency = DependencyFactory.create(job=build1.job)
     self.assertEqual(build2, dependency.get_current_build())
开发者ID:bigkevmcd,项目名称:capomastro,代码行数:10,代码来源:test_models.py

示例14: test_is_dependency_building

    def test_is_dependency_building(self):
        """
        is_building should return True if we have an active build for
        this dependency in the works.
        """
        dependency = DependencyFactory.create()
        self.assertFalse(dependency.is_building)

        BuildFactory.create(job=dependency.job)
        self.assertTrue(dependency.is_building)
开发者ID:bigkevmcd,项目名称:capomastro,代码行数:10,代码来源:test_models.py

示例15: test_dependency_detail_with_currently_building

    def test_dependency_detail_with_currently_building(self):
        """
        If the Dependency is currently building, we should get an info message
        with this in the page.
        """
        dependency = DependencyFactory.create()
        BuildFactory.create(job=dependency.job, status="STARTED")
        url = reverse("dependency_detail", kwargs={"pk": dependency.pk})
        response = self.app.get(url, user="testing")

        self.assertContains(response, "Dependency currently building")
开发者ID:notnownikki,项目名称:capomastro,代码行数:11,代码来源:test_views.py


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