本文整理汇总了Python中jenkins.tests.factories.BuildFactory.create_batch方法的典型用法代码示例。如果您正苦于以下问题:Python BuildFactory.create_batch方法的具体用法?Python BuildFactory.create_batch怎么用?Python BuildFactory.create_batch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jenkins.tests.factories.BuildFactory
的用法示例。
在下文中一共展示了BuildFactory.create_batch方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dependency_build_pagination
# 需要导入模块: from jenkins.tests.factories import BuildFactory [as 别名]
# 或者: from jenkins.tests.factories.BuildFactory import create_batch [as 别名]
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)
示例2: test_get_build_table_for_project_with_multiple_dependencies
# 需要导入模块: from jenkins.tests.factories import BuildFactory [as 别名]
# 或者: from jenkins.tests.factories.BuildFactory import create_batch [as 别名]
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)
示例3: test_dependency_build_pagination_page_invalid
# 需要导入模块: from jenkins.tests.factories import BuildFactory [as 别名]
# 或者: from jenkins.tests.factories.BuildFactory import create_batch [as 别名]
def test_dependency_build_pagination_page_invalid(self):
"""
The dependency build list should return the last page when an out-of-
range number is supplied.
"""
dependency = DependencyFactory.create()
BuildFactory.create_batch(
DependencyDetailView.PAGINATE_BUILDS + 1, job=dependency.job)
depend_url = reverse("dependency_detail", kwargs={"pk": dependency.pk})
depend_url += "?page=999"
response = self.app.get(depend_url, user="testing")
self.assertEqual(200, response.status_code)
self.assertEqual(len(response.context["builds"]), 1)
self.assertEqual(response.context["builds"].number, 2)
示例4: test_get_build_table_with_current_build_outside_recent
# 需要导入模块: from jenkins.tests.factories import BuildFactory [as 别名]
# 或者: from jenkins.tests.factories.BuildFactory import create_batch [as 别名]
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)
示例5: test_projectbuild_list_view
# 需要导入模块: from jenkins.tests.factories import BuildFactory [as 别名]
# 或者: from jenkins.tests.factories.BuildFactory import create_batch [as 别名]
def test_projectbuild_list_view(self):
"""
The list view should provide a list of projects.
"""
job = JobFactory.create()
BuildFactory.create_batch(5, job=job)
project = ProjectFactory.create()
ProjectDependency.objects.create(
project=project, dependency=DependencyFactory.create(job=job))
projectbuild = ProjectBuildFactory.create(project=project)
BuildFactory.create(job=job, build_id=projectbuild.build_id)
url = reverse("project_projectbuild_list", kwargs={"pk": project.pk})
response = self.app.get(url, user="testing")
self.assertEqual(200, response.status_code)
self.assertEqual(
set([projectbuild]), set(response.context["projectbuilds"]))
self.assertEqual(project, response.context["project"])
示例6: test_dependency_build_pagination_page_two
# 需要导入模块: from jenkins.tests.factories import BuildFactory [as 别名]
# 或者: from jenkins.tests.factories.BuildFactory import create_batch [as 别名]
def test_dependency_build_pagination_page_two(self):
"""
The dependency build list should return 1 record when retrieving the
second page.
"""
dependency = DependencyFactory.create()
BuildFactory.create_batch(
DependencyDetailView.PAGINATE_BUILDS + 1, job=dependency.job)
depend_url = reverse("dependency_detail", kwargs={"pk": dependency.pk})
depend_url += "?page=2"
response = self.app.get(depend_url, user="testing")
self.assertEqual(200, response.status_code)
self.assertEqual(len(response.context["builds"]), 1)
self.assertEqual(response.context["builds"].number, 2)
# Check that the 'Older' link is disabled
self.assertRaises(IndexError, response.click, "Older")
# Check that the 'newer' link takes us to page one
newer = response.click("Newer")
self.assertEqual(200, newer.status_code)
self.assertNotEquals(newer, response)
self.assertEqual(newer.context["builds"].number, 1)
示例7: test_project_dependencies
# 需要导入模块: from jenkins.tests.factories import BuildFactory [as 别名]
# 或者: from jenkins.tests.factories.BuildFactory import create_batch [as 别名]
def test_project_dependencies(self):
"""
Project Dependencies view should show all dependencies and the status
of their build.
"""
project = ProjectFactory.create()
dependency = DependencyFactory.create()
builds = BuildFactory.create_batch(5, job=dependency.job)
ProjectDependency.objects.create(
project=project, dependency=dependency, auto_track=False,
current_build=builds[-1])
project_url = reverse(
"project_dependencies", kwargs={"pk": project.pk})
response = self.app.get(project_url, user="testing")
self.assertEqual(200, response.status_code)
self.assertEqual(project, response.context["project"])
self.assertEqual(
[dependency],
list(response.context["builds_header"]))
示例8: test_get_build_table_for_project_with_single_dependency
# 需要导入模块: from jenkins.tests.factories import BuildFactory [as 别名]
# 或者: from jenkins.tests.factories.BuildFactory import create_batch [as 别名]
def test_get_build_table_for_project_with_single_dependency(self):
"""
We should get a table of rows for this dependency, indicating whether
or not the current build is the build.
"""
project = ProjectFactory.create()
dependency = DependencyFactory.create()
[build1, build2, build3, build4, build5] = BuildFactory.create_batch(
5, job=dependency.job)
ProjectDependency.objects.create(
project=project, dependency=dependency, auto_track=False,
current_build=build5)
header, table = get_build_table_for_project(project)
self.assertEqual([dependency], header)
self.assertEqual([
[{"build": build5, "current": True}],
[{"build": build4, "current": False}],
[{"build": build3, "current": False}],
[{"build": build2, "current": False}],
[{"build": build1, "current": False}]], table)