本文整理汇总了Python中pyjen.jenkins.Jenkins.create_view方法的典型用法代码示例。如果您正苦于以下问题:Python Jenkins.create_view方法的具体用法?Python Jenkins.create_view怎么用?Python Jenkins.create_view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjen.jenkins.Jenkins
的用法示例。
在下文中一共展示了Jenkins.create_view方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_jobs_no_jobs
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import create_view [as 别名]
def test_get_jobs_no_jobs(jenkins_env):
jk = Jenkins(jenkins_env["url"], (jenkins_env["admin_user"], jenkins_env["admin_token"]))
vw = jk.create_view("test_get_jobs_no_jobs_views", ListView)
with clean_view(vw):
jobs = vw.jobs
assert isinstance(jobs, list)
assert len(jobs) == 0
示例2: test_rename_view
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import create_view [as 别名]
def test_rename_view(jenkins_env):
jk = Jenkins(jenkins_env["url"], (jenkins_env["admin_user"], jenkins_env["admin_token"]))
original_view_name = "test_rename_view"
v = jk.create_view(original_view_name, SectionedView)
try:
expected_section_name = "MyNewSection"
v.add_section("hudson.plugins.sectioned_view.TextSection", expected_section_name)
expected_view_name = "test_rename_view2"
v.rename(expected_view_name)
assert jk.find_view(original_view_name) is None
finally:
tmp = jk.find_view(original_view_name)
if tmp:
tmp.delete()
with clean_view(v):
assert v.name == expected_view_name
tmp_view = jk.find_view(expected_view_name)
assert tmp_view is not None
assert tmp_view.name == expected_view_name
result = tmp_view.sections
assert result is not None
assert isinstance(result, list)
assert len(result) == 1
assert result[0].name == expected_section_name
示例3: test_find_multiple_nested_sub_views
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import create_view [as 别名]
def test_find_multiple_nested_sub_views(jenkins_env):
jk = Jenkins(jenkins_env["url"], (jenkins_env["admin_user"], jenkins_env["admin_token"]))
parent1 = jk.create_view("test_find_multiple_nested_sub_views_parent1", NestedView)
with clean_view(parent1):
parent2 = parent1.create_view("test_find_multiple_nested_sub_views_parent2", NestedView)
with clean_view(parent2):
expected_view_name = "test_find_multiple_nested_sub_views_child"
# Views in Jenkins must be unique within the same parent view, but
# nested views may contain sub-views with the same name as their
# ancestors / siblings. So we create 2 views with the same name in
# each of our parent views to make sure they get resolved correctly
child1 = parent1.create_view(expected_view_name, ListView)
assert child1 is not None
with clean_view(child1):
child2 = parent2.create_view(expected_view_name, ListView)
assert child2 is not None
with clean_view(child2):
results = parent1.find_all_views(expected_view_name)
assert results is not None
assert isinstance(results, list)
assert len(results) == 2
assert results[0].name == expected_view_name
assert results[1].name == expected_view_name
示例4: test_find_non_existent_view
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import create_view [as 别名]
def test_find_non_existent_view(jenkins_env):
jk = Jenkins(jenkins_env["url"], (jenkins_env["admin_user"], jenkins_env["admin_token"]))
parent = jk.create_view("test_find_non_existent_view", NestedView)
with clean_view(parent):
result = parent.find_view("FindViewDoesNotExist")
assert result is not None
assert isinstance(result, list)
assert len(result) == 0
示例5: test_nested_views_empty
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import create_view [as 别名]
def test_nested_views_empty(jenkins_env):
jk = Jenkins(jenkins_env["url"], (jenkins_env["admin_user"], jenkins_env["admin_token"]))
parent = jk.create_view("test_all_nested_views_empty", NestedView)
with clean_view(parent):
result = parent.views
assert result is not None
assert isinstance(result, list)
assert len(result) == 0
示例6: test_list_section_no_regex
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import create_view [as 别名]
def test_list_section_no_regex(jenkins_env):
jk = Jenkins(jenkins_env["url"], (jenkins_env["admin_user"], jenkins_env["admin_token"]))
v = jk.create_view("test_list_section_no_regex", SectionedView)
with clean_view(v):
v.add_section("hudson.plugins.sectioned_view.ListViewSection", "MyNewSection")
section = v.sections[0]
assert section.include_regex == ""
示例7: test_create_status_view
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import create_view [as 别名]
def test_create_status_view(jenkins_env):
jk = Jenkins(jenkins_env["url"], (jenkins_env["admin_user"], jenkins_env["admin_token"]))
expected_view_name = "test_create_status_view"
v = jk.create_view(expected_view_name, StatusView)
assert v is not None
with clean_view(v):
assert isinstance(v, StatusView)
assert v.name == expected_view_name
示例8: test_create_sub_view
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import create_view [as 别名]
def test_create_sub_view(jenkins_env):
jk = Jenkins(jenkins_env["url"], (jenkins_env["admin_user"], jenkins_env["admin_token"]))
parent = jk.create_view("test_create_sub_view", NestedView)
with clean_view(parent):
expected_view_name = "test_create_sub_view1"
child = parent.create_view(expected_view_name, ListView)
assert child is not None
with clean_view(child):
assert child.name == expected_view_name
示例9: test_get_sections_empty
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import create_view [as 别名]
def test_get_sections_empty(jenkins_env):
jk = Jenkins(jenkins_env["url"], (jenkins_env["admin_user"], jenkins_env["admin_token"]))
expected_view_name = "test_get_sections_empty"
v = jk.create_view(expected_view_name, SectionedView)
with clean_view(v):
result = v.sections
assert result is not None
assert isinstance(result, list)
assert len(result) == 0
示例10: test_clone_view
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import create_view [as 别名]
def test_clone_view(jenkins_env):
jk = Jenkins(jenkins_env["url"], (jenkins_env["admin_user"], jenkins_env["admin_token"]))
vw = jk.create_view("test_clone_view1", ListView)
with clean_view(vw):
expected_name = "test_clone_view2"
vw2 = vw.clone(expected_name)
assert vw2 is not None
with clean_view(vw2):
assert vw2.name == expected_name
assert isinstance(vw2, type(vw))
示例11: test_create_view
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import create_view [as 别名]
def test_create_view(self):
new_view_url = "http://localhost:8080/view/MyView"
new_view_name = "MyView"
new_view_dataio = MagicMock()
new_view_dataio.get_api_data.return_value = {'name':new_view_name}
new_view_dataio.config_xml = "<hudson.model.ListView/>"
self.mock_jenkins_data_io.get_api_data.return_value['views'].append({'url':new_view_url,'name':new_view_name})
self.clone_map[new_view_url] = new_view_dataio
j = Jenkins(self.mock_jenkins_data_io)
v = j.create_view(new_view_name, "ListView")
self.assertEqual(v.name, new_view_name)
示例12: test_add_text_section
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import create_view [as 别名]
def test_add_text_section(jenkins_env):
jk = Jenkins(jenkins_env["url"], (jenkins_env["admin_user"], jenkins_env["admin_token"]))
v = jk.create_view("test_add_text_section", SectionedView)
with clean_view(v):
expected_name = "MyNewSection"
v.add_section("hudson.plugins.sectioned_view.TextSection", expected_name)
result = v.sections
assert result is not None
assert isinstance(result, list)
assert len(result) == 1
assert result[0].name == expected_name
示例13: test_find_sub_view
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import create_view [as 别名]
def test_find_sub_view(jenkins_env):
jk = Jenkins(jenkins_env["url"], (jenkins_env["admin_user"], jenkins_env["admin_token"]))
parent = jk.create_view("test_find_sub_view", NestedView)
with clean_view(parent):
expected_view_name = "test_find_sub_view1"
child = parent.create_view(expected_view_name, ListView)
assert child is not None
with clean_view(child):
result = parent.find_view(expected_view_name)
assert result is not None
assert isinstance(result, list)
assert len(result) == 1
assert result[0].name == child.name
示例14: test_get_multiple_views
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import create_view [as 别名]
def test_get_multiple_views(jenkins_env):
jk = Jenkins(jenkins_env["url"], (jenkins_env["admin_user"], jenkins_env["admin_token"]))
test_view_name = "test_get_multiple_views_view"
vw = jk.create_view(test_view_name, ListView)
with clean_view(vw):
v = jk.views
assert v is not None
assert isinstance(v, list)
assert len(v) == 2
assert v[0].name in ["all", test_view_name]
assert v[1].name in ["all", test_view_name]
assert v[0].name != v[1].name
示例15: test_clone_sub_view
# 需要导入模块: from pyjen.jenkins import Jenkins [as 别名]
# 或者: from pyjen.jenkins.Jenkins import create_view [as 别名]
def test_clone_sub_view(jenkins_env):
jk = Jenkins(jenkins_env["url"], (jenkins_env["admin_user"], jenkins_env["admin_token"]))
parent = jk.create_view("test_clone_sub_view_parent", NestedView)
with clean_view(parent):
child1 = parent.create_view("test_clone_sub_view_child1", ListView)
with clean_view(child1):
expected_view_name = "test_clone_sub_view_child2"
child2 = child1.clone(expected_view_name)
assert child2 is not None
with clean_view(child2):
assert parent.find_view(expected_view_name)
assert child2.name == expected_view_name
assert isinstance(child2, type(child1))