• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python update.update函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_superadmin_tenant_crud

def test_superadmin_tenant_crud(request):
    """Test suppose to verify CRUD operations for CFME tenants

    Prerequisities:
        * This test is not depending on any other test and can be executed against fresh appliance.

    Steps:
        * Create tenant
        * Update description of tenant
        * Update name of tenat
        * Delete tenant
    """
    tenant = ac.Tenant(
        name='tenant1' + fauxfactory.gen_alphanumeric(),
        description='tenant1 description')

    @request.addfinalizer
    def _delete_tenant():
        if tenant.exists:
            tenant.delete()

    tenant.create()
    with update(tenant):
        tenant.description = tenant.description + "edited"
    with update(tenant):
        tenant.name = tenant.name + "edited"
    tenant.delete()
开发者ID:pavelzag,项目名称:cfme_tests,代码行数:27,代码来源:test_access_control.py


示例2: test_repository_crud

def test_repository_crud(soft_assert, random_string, request):
    repo_name = 'Test Repo {}'.format(random_string)
    repo = repositories.Repository(repo_name, '//testhost/share/path')
    request.addfinalizer(repo.delete)

    # create
    repo.create()

    # read
    assert repo.exists

    # update
    with update(repo):
        repo.name = 'Updated {}'.format(repo_name)

    with soft_assert.catch_assert():
        assert repo.exists, 'Repository rename failed'

        # Only change the name back if renaming succeeded
        with update(repo):
            repo.name = repo_name

    # delete
    repo.delete()
    try:
        wait_for(lambda: not repo.exists)
    except TimedOutError:
        raise AssertionError('failed to delete repository')
开发者ID:MattLombana,项目名称:cfme_tests,代码行数:28,代码来源:test_repositories.py


示例3: test_superadmin_tenant_project_crud

def test_superadmin_tenant_project_crud(request):
    """Test suppose to verify CRUD operations for CFME projects

    Prerequisities:
        * This test is not depending on any other test and can be executed against fresh appliance.

    Steps:
        * Create tenant
        * Create project as child to tenant
        * Update description of project
        * Update name of project
        * Delete project
        * Delete tenant
    """
    tenant = Tenant(name="tenant1" + fauxfactory.gen_alphanumeric(), description="tenant1 description")
    project = Project(
        name="project1" + fauxfactory.gen_alphanumeric(), description="project1 description", parent_tenant=tenant
    )

    @request.addfinalizer
    def _delete_tenant_and_project():
        for item in [project, tenant]:
            if item.exists:
                item.delete()

    tenant.create()
    project.create()
    with update(project):
        project.description = project.description + "edited"
    with update(project):
        project.name = project.name + "edited"
    project.delete()
    tenant.delete()
开发者ID:ManageIQ,项目名称:integration_tests,代码行数:33,代码来源:test_access_control.py


示例4: test_display_name_unset_from_ui

def test_display_name_unset_from_ui(request, an_instance):
    an_instance.create()
    request.addfinalizer(an_instance.delete)
    with update(an_instance):
        an_instance.display_name = generate_random_string()
    assert an_instance.exists
    with update(an_instance):
        an_instance.display_name = ""
    assert an_instance.exists
开发者ID:petrblaho,项目名称:cfme_tests,代码行数:9,代码来源:test_instance.py


示例5: test_display_name_unset_from_ui

def test_display_name_unset_from_ui(request, a_class):
    a_class.create()
    request.addfinalizer(a_class.delete)
    with update(a_class):
        a_class.display_name = generate_random_string()
    assert a_class.exists
    with update(a_class):
        a_class.display_name = ""
    assert a_class.exists
开发者ID:petrblaho,项目名称:cfme_tests,代码行数:9,代码来源:test_class.py


示例6: test_vm_analysis_profile_crud

def test_vm_analysis_profile_crud():
    """CRUD for VM analysis profiles."""
    p = VMAnalysisProfile(fauxfactory.gen_alphanumeric(), fauxfactory.gen_alphanumeric(), files=["asdf", "dfg"])
    p.create()
    with update(p):
        p.files = ["qwer"]
    with update(p):
        p.categories = ["check_system"]
    p.delete()
开发者ID:pombredanne,项目名称:cfme_tests,代码行数:9,代码来源:test_analysis_profiles.py


示例7: test_namespace_crud

def test_namespace_crud(namespace):
    namespace.create()
    old_name = namespace.name
    with update(namespace):
        namespace.name = fauxfactory.gen_alphanumeric(8)
    with update(namespace):
        namespace.name = old_name
    namespace.delete()
    assert not namespace.exists()
开发者ID:pombredanne,项目名称:cfme_tests,代码行数:9,代码来源:test_namespace.py


示例8: test_vm_analysis_profile_crud

def test_vm_analysis_profile_crud():
    """CRUD for VM analysis profiles."""
    p = VMAnalysisProfile(generate_random_string(), generate_random_string(), files=["asdf", "dfg"])
    p.create()
    with update(p):
        p.files = ["qwer"]
    with update(p):
        p.categories = ["check_system"]
    p.delete()
开发者ID:petrblaho,项目名称:cfme_tests,代码行数:9,代码来源:test_analysis_profiles.py


示例9: test_class_crud

def test_class_crud(a_class):
    a_class.create()
    orig = a_class.description
    with update(a_class):
        a_class.description = 'edited'
    with update(a_class):
        a_class.description = orig
    a_class.delete()
    assert not a_class.exists()
开发者ID:jkrocil,项目名称:cfme_tests,代码行数:9,代码来源:test_class.py


示例10: test_namespace_crud

def test_namespace_crud(namespace):
    namespace.create()
    old_name = namespace.name
    with update(namespace):
        namespace.name = generate_random_string(8)
    with update(namespace):
        namespace.name = old_name
    namespace.delete()
    assert not namespace.exists()
开发者ID:petrblaho,项目名称:cfme_tests,代码行数:9,代码来源:test_namespace.py


示例11: test_display_name_unset_from_ui

def test_display_name_unset_from_ui(request, an_instance):
    an_instance.create()
    request.addfinalizer(an_instance.delete)
    with update(an_instance):
        an_instance.display_name = fauxfactory.gen_alphanumeric()
    assert an_instance.exists
    with update(an_instance):
        an_instance.display_name = ""
    assert an_instance.exists
开发者ID:pombredanne,项目名称:cfme_tests,代码行数:9,代码来源:test_instance.py


示例12: test_instance_crud

def test_instance_crud(an_instance):
    an_instance.create()
    origname = an_instance.name
    with update(an_instance):
        an_instance.name = fauxfactory.gen_alphanumeric(8)
        an_instance.description = "updated"
    with update(an_instance):
        an_instance.name = origname
    an_instance.delete()
    assert not an_instance.exists()
开发者ID:pombredanne,项目名称:cfme_tests,代码行数:10,代码来源:test_instance.py


示例13: test_method_crud

def test_method_crud(a_method):
    a_method.create()
    origname = a_method.name
    with update(a_method):
        a_method.name = generate_random_string(8)
        a_method.data = "bar"
    with update(a_method):
        a_method.name = origname
    a_method.delete()
    assert not a_method.exists()
开发者ID:jkrocil,项目名称:cfme_tests,代码行数:10,代码来源:test_method.py


示例14: test_instance_crud

def test_instance_crud(an_instance):
    an_instance.create()
    origname = an_instance.name
    with update(an_instance):
        an_instance.name = generate_random_string(8)
        an_instance.description = "updated"
    with update(an_instance):
        an_instance.name = origname
    an_instance.delete()
    assert not an_instance.exists()
开发者ID:petrblaho,项目名称:cfme_tests,代码行数:10,代码来源:test_instance.py


示例15: test_instance_display_name_unset_from_ui

def test_instance_display_name_unset_from_ui(request, klass):
    instance = klass.instances.create(
        name=fauxfactory.gen_alphanumeric(),
        display_name=fauxfactory.gen_alphanumeric())
    with update(instance):
        instance.display_name = fauxfactory.gen_alphanumeric()
    assert instance.exists
    with update(instance):
        instance.display_name = ""
    assert instance.exists
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:10,代码来源:test_instance.py


示例16: test_method_crud

def test_method_crud(a_method):
    a_method.create()
    origname = a_method.name
    with update(a_method):
        a_method.name = fauxfactory.gen_alphanumeric(8)
        a_method.data = "bar"
    with update(a_method):
        a_method.name = origname
    a_method.delete()
    assert not a_method.exists()
开发者ID:anewmanRH,项目名称:cfme_tests,代码行数:10,代码来源:test_method.py


示例17: test_provider_edit

def test_provider_edit(provider_crud):
    """ Tests that editing a management system shows the proper detail after an edit."""
    provider_crud.create()
    old_name = provider_crud.name
    with update(provider_crud) as provider_crud:
        provider_crud.name = str(uuid.uuid4())  # random uuid
    flash.assert_message_match('Cloud Provider "%s" was saved' % provider_crud.name)

    with update(provider_crud) as provider_crud:
        provider_crud.name = old_name  # old name
    flash.assert_message_match('Cloud Provider "%s" was saved' % provider_crud.name)
开发者ID:kbrock,项目名称:cfme_tests,代码行数:11,代码来源:test_providers.py


示例18: test_vm_analysis_profile_crud

def test_vm_analysis_profile_crud():
    """CRUD for VM analysis profiles."""
    p = AnalysisProfile(name=fauxfactory.gen_alphanumeric(),
                        description=fauxfactory.gen_alphanumeric(),
                        profile_type='VM', files=["asdf", "dfg"])
    p.create()
    with update(p):
        p.files = ["qwer"]
    with update(p):
        p.categories = ["check_system"]
    p.delete()
开发者ID:ManageIQ,项目名称:integration_tests,代码行数:11,代码来源:test_analysis_profiles.py


示例19: test_class_display_name_unset_from_ui

def test_class_display_name_unset_from_ui(request, namespace):
    a_class = namespace.classes.create(
        name=fauxfactory.gen_alphanumeric(),
        display_name=fauxfactory.gen_alphanumeric(),
        description=fauxfactory.gen_alphanumeric()
    )
    with update(a_class):
        a_class.display_name = fauxfactory.gen_alphanumeric()
    assert a_class.exists
    with update(a_class):
        a_class.display_name = ""
    assert a_class.exists
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:12,代码来源:test_class.py


示例20: test_domain_lock_unlock

def test_domain_lock_unlock(request):
    domains = DomainCollection()
    domain = domains.create(
        name=fauxfactory.gen_alpha(),
        description=fauxfactory.gen_alpha(),
        enabled=True)
    request.addfinalizer(domain.delete)
    ns1 = domain.namespaces.create(name='ns1')
    ns2 = ns1.namespaces.create(name='ns2')
    cls = ns2.classes.create(name='class1')
    cls.schema.add_field(name='myfield', type='Relationship')
    inst = cls.instances.create(name='inst')
    meth = cls.methods.create(name='meth', script='$evm')
    # Lock the domain
    domain.lock()
    # Check that nothing is editable
    # namespaces
    details = navigate_to(ns1, 'Details')
    assert not details.configuration.is_displayed
    details = navigate_to(ns2, 'Details')
    assert not details.configuration.is_displayed
    # class
    details = navigate_to(cls, 'Details')
    assert details.configuration.items == ['Copy selected Instances']
    assert not details.configuration.item_enabled('Copy selected Instances')
    details.schema.select()
    assert not details.configuration.is_displayed
    # instance
    details = navigate_to(inst, 'Details')
    assert details.configuration.items == ['Copy this Instance']
    # method
    details = navigate_to(meth, 'Details')
    assert details.configuration.items == ['Copy this Method']
    # Unlock it
    domain.unlock()
    # Check that it is editable
    with update(ns1):
        ns1.name = 'UpdatedNs1'
    assert ns1.exists
    with update(ns2):
        ns2.name = 'UpdatedNs2'
    assert ns2.exists
    with update(cls):
        cls.name = 'UpdatedClass'
    assert cls.exists
    cls.schema.add_field(name='myfield2', type='Relationship')
    with update(inst):
        inst.name = 'UpdatedInstance'
    assert inst.exists
    with update(meth):
        meth.name = 'UpdatedMethod'
    assert meth.exists
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:52,代码来源:test_domain.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python urlnorm.normalize函数代码示例发布时间:2022-05-26
下一篇:
Python tools.write_json函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap