當前位置: 首頁>>代碼示例>>Python>>正文


Python utils.Version類代碼示例

本文整理匯總了Python中widgetastic.utils.Version的典型用法代碼示例。如果您正苦於以下問題:Python Version類的具體用法?Python Version怎麽用?Python Version使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Version類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: create

    def create(self, cancel=False):
        """Create new keypair"""
        def refresh():
            self.provider.refresh_provider_relationships()
            view.browser.selenium.refresh()
            view.flush_widget_cache()

        view = navigate_to(self, 'Add')
        view.form.fill({'name': self.name,
                        'public_key': self.public_key,
                        'provider': self.provider.name})
        if cancel:
            view.form.cancel.click()
            flash_message = 'Add of new Key Pair was cancelled by the user'
        else:
            view.form.add.click()
            flash_message = VersionPick({
                Version.lowest(): 'Creating Key Pair {}'.format(self.name),
                '5.8': 'Key Pair "{}" created'.format(self.name)}).pick(self.appliance.version)

        # add/cancel should redirect, new view
        view = self.create_view(KeyPairAllView)
        # TODO BZ 1444520 causing ridiculous redirection times after submitting the form
        wait_for(lambda: view.is_displayed, fail_condition=False, num_sec=120, delay=3,
                 fail_func=lambda: view.flush_widget_cache(), handle_exception=True)
        view = self.create_view(KeyPairAllView)
        view.entities.flash.assert_no_error()
        view.entities.flash.assert_success_message(flash_message)
開發者ID:dajohnso,項目名稱:cfme_tests,代碼行數:28,代碼來源:keypairs.py

示例2: pytest_generate_tests

def pytest_generate_tests(metafunc):
    """
    Build a list of tuples containing (group_name, context)
    Returns:
        tuple containing (group_name, context)
        where group_name is a string and context is ViaUI/SSUI
    """
    appliance = find_appliance(metafunc)
    parameter_list = []
    id_list = []
    # TODO: Include SSUI role_access dict and VIASSUI context
    role_access_ui = VersionPick({
        Version.lowest(): role_access_ui_58z,
        '5.9': role_access_ui_59z,
        '5.10': role_access_ui_510z
    }).pick(appliance.version)
    logger.info('Using the role access dict: %s', role_access_ui)
    roles_and_context = [(
        role_access_ui, ViaUI)
    ]
    for role_access, context in roles_and_context:
        for group in role_access.keys():
            parameter_list.append((group, role_access, context))
            id_list.append('{}-{}'.format(group, context))
    metafunc.parametrize('group_name, role_access, context', parameter_list)
開發者ID:lcouzens,項目名稱:cfme_tests,代碼行數:25,代碼來源:test_aws_iam_auth_and_roles.py

示例3: all

    def all(self):
        # containers table has ems_id, join with ext_mgmgt_systems on id for provider name
        # Then join with container_groups on the id for the pod
        # TODO Update to use REST API instead of DB queries
        container_table = self.appliance.db.client['containers']
        ems_table = self.appliance.db.client['ext_management_systems']
        pod_table = self.appliance.db.client['container_groups']
        container_pod_id = (
            VersionPick({
                Version.lowest(): getattr(container_table, 'container_definition_id', None),
                '5.9': getattr(container_table, 'container_group_id', None)})
            .pick(self.appliance.version))
        container_query = (
            self.appliance.db.client.session
                .query(container_table.name, pod_table.name, ems_table.name)
                .join(ems_table, container_table.ems_id == ems_table.id)
                .join(pod_table, container_pod_id == pod_table.id))
        if self.filters.get('archived'):
            container_query = container_query.filter(container_table.deleted_on.isnot(None))
        if self.filters.get('active'):
            container_query = container_query.filter(container_table.deleted_on.is_(None))
        provider = None
        # filtered
        if self.filters.get('provider'):
            provider = self.filters.get('provider')
            container_query = container_query.filter(ems_table.name == provider.name)
        containers = []
        for name, pod_name, ems_name in container_query.all():
            containers.append(
                self.instantiate(name=name, pod=pod_name,
                                 provider=provider or get_crud_by_name(ems_name)))

        return containers
開發者ID:lcouzens,項目名稱:cfme_tests,代碼行數:33,代碼來源:container.py

示例4: ProviderEntity

def ProviderEntity():  # noqa
    """ Temporary wrapper for Provider Entity during transition to JS based Entity

    """
    return VersionPick({
        Version.lowest(): NonJSProviderEntity,
        '5.9': JSProviderEntity,
    })
開發者ID:hhovsepy,項目名稱:cfme_tests,代碼行數:8,代碼來源:provider_views.py

示例5: parent_provider

 def parent_provider(self):
     """ Return object of parent cloud provider """
     view = navigate_to(self, 'Details')
     parent_cloud_text = VersionPick({Version.lowest(): 'Parent ems cloud',
                                      '5.10': 'Parent Cloud Provider'}
                                     ).pick(self.appliance.version)
     provider_name = view.entities.relationships.get_text_of(parent_cloud_text)
     return providers.get_crud_by_name(provider_name)
開發者ID:apagac,項目名稱:cfme_tests,代碼行數:8,代碼來源:cloud_network.py

示例6: is_displayed

 def is_displayed(self):
     title = VersionPicker({
         Version.lowest(): '{name} (All VM Templates)'.format(name=self.context['object'].name),
         '5.10': '{name} (All VM Templates and Images)'.format(name=self.context['object'].name),
     }).pick(self.extra.appliance.version)
     return (self.logged_in_as_current_user and
             self.navigation.currently_selected == ['Compute', 'Infrastructure', 'Providers'] and
             self.title.text == title)
開發者ID:apagac,項目名稱:cfme_tests,代碼行數:8,代碼來源:provider_views.py

示例7: HostEntity

def HostEntity():  # noqa
    """ Temporary wrapper for Host Entity during transition to JS based Entity

    """
    return VersionPick({
        Version.lowest(): NonJSHostEntity,
        '5.9': JSBaseEntity,
    })
開發者ID:dajohnso,項目名稱:cfme_tests,代碼行數:8,代碼來源:host_views.py

示例8: before_filling

 def before_filling(self):
     item_type = self.context['object'].provider_type or \
         self.context['object'].item_type or 'Generic'
     if item_type == 'AnsibleTower':
         item_type = VersionPick({
             Version.lowest(): "AnsibleTower",
             "5.9": "Ansible Tower"
         })
     self.select_item_type.select_by_visible_text(item_type)
     self.flush_widget_cache()
開發者ID:akarol,項目名稱:cfme_tests,代碼行數:10,代碼來源:catalog_item.py

示例9: delete

    def delete(self, cancel=False, wait=False):
        view = navigate_to(self, 'Details')
        # TODO: get rid of this resolve when widgetastic.core/pull/68 is merged
        item_name = VersionPick({Version.lowest(): 'Remove this Key Pair',
                                '5.9': 'Remove this Key Pair from Inventory'}
                                ).pick(self.appliance.version)
        view.toolbar.configuration.item_select(item_name,
                                               handle_alert=(not cancel))
        # cancel doesn't redirect, confirmation does
        view.flush_widget_cache()
        if cancel:
            view = self.create_view(KeyPairDetailsView)
        else:
            view = self.create_view(KeyPairAllView)
        wait_for(lambda: view.is_displayed, fail_condition=False, num_sec=10, delay=1)

        # flash message only displayed if it was deleted
        if not cancel:
            view.flash.assert_no_error()
            view.flash.assert_success_message('Delete initiated for 1 Key Pair')

        if wait:
            def refresh():
                self.provider.refresh_provider_relationships()
                view.browser.refresh()
                view.flush_widget_cache()

            view = navigate_to(self.parent, 'All')

            wait_for(
                lambda: self.name in view.entities.all_entity_names,
                message="Wait keypairs to disappear",
                fail_condition=True,
                num_sec=300,
                delay=5,
                fail_func=refresh
            )
開發者ID:hhovsepy,項目名稱:cfme_tests,代碼行數:37,代碼來源:keypairs.py

示例10: view_classes

 def view_classes(self):
     return VersionPick({
         Version.lowest(): RetirementView,
         "5.9": RetirementViewWithOffset
     })
開發者ID:LandoCalrizzian,項目名稱:cfme_tests,代碼行數:5,代碼來源:__init__.py

示例11: ManageIQTree

def ManageIQTree(tree_id=None):  # noqa
    return VersionPick({
        Version.lowest(): DynaTree(tree_id),
        '5.7.0.1': BootstrapTreeview(tree_id),
    })
開發者ID:RonnyPfannschmidt,項目名稱:cfme_tests,代碼行數:5,代碼來源:widgetastic_manageiq.py

示例12: container_provider_edit_view_class

 def container_provider_edit_view_class(self):
     return VersionPick({
         Version.lowest(): ContainerProviderEditView,
         '5.9': ContainerProviderEditViewUpdated
     })
開發者ID:hhovsepy,項目名稱:cfme_tests,代碼行數:5,代碼來源:__init__.py

示例13: step

 def step(self):
     self.prerequisite_view.toolbar.configuration.item_select(
         VersionPick({
             Version.lowest(): 'Add Existing Containers Provider',
             '5.9': 'Add a new Containers Provider'
         }).pick(self.obj.appliance.version))
開發者ID:hhovsepy,項目名稱:cfme_tests,代碼行數:6,代碼來源:__init__.py

示例14: DeploymentRoleEntity

def DeploymentRoleEntity():  # noqa
    """Temporary wrapper for Deployment Role Entity during transition to JS based Entity """
    return VersionPick({
        Version.lowest(): NonJSDepRoleEntity,
        '5.9': JSBaseEntity,
    })
開發者ID:lcouzens,項目名稱:cfme_tests,代碼行數:6,代碼來源:deployment_roles.py

示例15: DatastoreEntity

def DatastoreEntity():  # noqa
    """Temporary wrapper for Datastore Entity during transition to JS based Entity """
    return VersionPick({
        Version.lowest(): NonJSDatastoreEntity,
        '5.9': JSDatastoreEntity,
    })
開發者ID:akarol,項目名稱:cfme_tests,代碼行數:6,代碼來源:datastore.py


注:本文中的widgetastic.utils.Version類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。