def _tag_item_through_selecting(request, location, tag): """Add a tag to an item with going through the details page. Prerequisities: * Have a tag category and tag created. * Be on the page you want to test. Steps: * Select any quadicon. * Select ``Policy/Edit Tags`` and assign the tag to it. * Click on the quadicon and verify the tag is assigned. (TODO) * Go back to the quadicon view and select ``Policy/Edit Tags`` and remove the tag. * Click on the quadicon and verify the tag is not present. (TODO) """ if not _navigate_and_check(location): pytest.skip("No Quadicon present, cannot test.") Quadicon.select_first_quad() def _delete(): # Ignoring the result of the check here _navigate_and_check(location) Quadicon.select_first_quad() mixins.remove_tag(tag) request.addfinalizer(lambda: diaper(_delete)) mixins.add_tag(tag) _delete()
def test_tag_infra_item_through_details(location, tag): """Add a tag to a infra item """ pytest.sel.force_navigate(location) pytest.sel.click(Quadicon.first()) mixins.add_tag(tag) mixins.remove_tag(tag)
def test_tag_infra_item_through_selecting(location, tag): """Add a tag to a infra item """ pytest.sel.force_navigate(location) Quadicon.select_first_quad() mixins.add_tag(tag) Quadicon.select_first_quad() # It goes back to the list view. mixins.remove_tag(tag)
def tag(self, tag): """Tags the system by given tag""" self.navigate() # Workaround for BZ#1241867 tb.select('Policy', 'Edit Tags') fill(mixins.tag_form, {'category': 'Cost Center *', 'tag': 'Cost Center 001'}) # --- mixins.add_tag(tag, navigate=False)
def tag(self, tag): """Tags the system by given tag""" navigate_to(self, 'EditTags') fill(mixins.tag_form, { 'category': 'Cost Center *', 'tag': 'Cost Center 001' }) # --- mixins.add_tag(tag, navigate=False)
def test_tag_orchestration_template(provisioning, tag, create_template): template_type = provisioning['stack_provisioning']['template_type'] template = OrchestrationTemplate(template_type=template_type, template_name=fauxfactory.gen_alphanumeric(), description="my template") template.create(create_template) navigate_to(template, "Details") mixins.add_tag(tag) mixins.remove_tag(tag) template.delete()
def test_tag_item_through_details(request, location, tag): """Add a tag to an item.""" pytest.sel.force_navigate(location) tb.set_vms_grid_view() if not Quadicon.any_present: pytest.skip("No Quadicon present, cannot test.") pytest.sel.click(Quadicon.first()) request.addfinalizer(lambda: diaper(lambda: mixins.remove_tag(tag))) mixins.add_tag(tag) mixins.remove_tag(tag)
def test_tag_orchestration_template(provisioning, tag, create_template): template_type = provisioning['stack_provisioning']['template_type'] template = OrchestrationTemplate( template_type=template_type, template_name=fauxfactory.gen_alphanumeric(), description="my template") template.create(create_template) navigate_to(template, "Details") mixins.add_tag(tag) mixins.remove_tag(tag) template.delete()
def test_tag_orchestration_template(provisioning, tag): template_type = provisioning['stack_provisioning']['template_type'] template = OrchestrationTemplate(template_type=template_type, template_name=fauxfactory.gen_alphanumeric(), description="my template") template.create(METHOD_TORSO) sel.force_navigate('select_template', context={ 'template_type': template.template_type, 'template_name': template.template_name}) mixins.add_tag(tag) mixins.remove_tag(tag) template.delete()
def test_tag_orchestration_template(provisioning, tag, create_template): template_type = provisioning['stack_provisioning']['template_type'] template = OrchestrationTemplate(template_type=template_type, template_name=fauxfactory.gen_alphanumeric(), description="my template") template.create(create_template) sel.force_navigate('select_template', context={ 'template_type': template.template_type, 'template_name': template.template_name}) mixins.add_tag(tag) mixins.remove_tag(tag) template.delete()
def test_tag_item_through_selecting(request, location, tag): """Add a tag to an item.""" pytest.sel.force_navigate(location) tb.set_vms_grid_view() if not Quadicon.any_present: pytest.skip("No Quadicon present, cannot test.") Quadicon.select_first_quad() def _delete(): pytest.sel.force_navigate(location) tb.set_vms_grid_view() Quadicon.select_first_quad() mixins.remove_tag(tag) request.addfinalizer(lambda: diaper(_delete)) mixins.add_tag(tag) _delete()
def _tag_item_through_details(request, location, tag, appliance): """Add a tag to an item with going through the details page. Prerequisities: * Have a tag category and tag created. * Be on the page you want to test. Steps: * Click any quadicon. * On the details page, select ``Policy/Edit Tags`` and assign the tag to it. * Verify the tag is assigned. (TODO) * Select ``Policy/Edit Tags`` and remove the tag. * Verify the tag is not present. (TODO) """ entity = _navigate_and_check(location, appliance) entity.click() request.addfinalizer(lambda: diaper(lambda: mixins.remove_tag(tag))) mixins.add_tag(tag) mixins.remove_tag(tag)
def test_tag_item_through_details(request, location, tag): """Add a tag to an item with going through the details page. Prerequisities: * Have a tag category and tag created. * Be on the page you want to test. Steps: * Click any quadicon. * On the details page, select ``Policy/Edit Tags`` and assign the tag to it. * Verify the tag is assigned. (TODO) * Select ``Policy/Edit Tags`` and remove the tag. * Verify the tag is not present. (TODO) """ if not navigate_and_check(location): pytest.skip("No Quadicon present, cannot test.") pytest.sel.click(Quadicon.first()) request.addfinalizer(lambda: diaper(lambda: mixins.remove_tag(tag))) mixins.add_tag(tag) mixins.remove_tag(tag)
def _check_item_visibility(vis_object, visibility_result): """ Args: visibility_result: pass 'True' is item should be visible, 'False' if not """ navigate_to(vis_object, 'Details') if visibility_result: mixins.add_tag(tag) else: try: mixins.remove_tag(tag) except TypeError: logger.debug('Tag is already removed') actual_visibility = False with user_restricted: try: navigate_to(vis_object, 'Details') actual_visibility = True except Exception: logger.debug('Tagged item is not visible') assert actual_visibility == visibility_result
def test_tag_item_through_details(request, location, tag): """Add a tag to an item with going through the details page. Prerequisities: * Have a tag category and tag created. * Be on the page you want to test. Steps: * Click any quadicon. * On the details page, select ``Policy/Edit Tags`` and assign the tag to it. * Verify the tag is assigned. (TODO) * Select ``Policy/Edit Tags`` and remove the tag. * Verify the tag is not present. (TODO) """ pytest.sel.force_navigate(location) tb.select('Grid View') if not Quadicon.any_present(): pytest.skip("No Quadicon present, cannot test.") pytest.sel.click(Quadicon.first()) request.addfinalizer(lambda: diaper(lambda: mixins.remove_tag(tag))) mixins.add_tag(tag) mixins.remove_tag(tag)
def _tag_item_through_selecting(request, location, tag, appliance): """Add a tag to an item with going through the details page. Prerequisities: * Have a tag category and tag created. * Be on the page you want to test. Steps: * Select any quadicon. * Select ``Policy/Edit Tags`` and assign the tag to it. * Click on the quadicon and verify the tag is assigned. (TODO) * Go back to the quadicon view and select ``Policy/Edit Tags`` and remove the tag. * Click on the quadicon and verify the tag is not present. (TODO) """ _navigate_and_check(location, appliance) def _delete(): # Ignoring the result of the check here _navigate_and_check(location, appliance) mixins.remove_tag(tag) request.addfinalizer(lambda: diaper(_delete)) mixins.add_tag(tag) _delete()
def tag(self, tag, **kwargs): """Tags the system by given tag""" sel.force_navigate('infrastructure_host', context={'host': self}) mixins.add_tag(tag, **kwargs)
def tag(self, tag, **kwargs): """Tags the system by given tag""" navigate_to(self, 'Details') mixins.add_tag(tag, **kwargs)
def add_tag(self, tag, single_value=False): self.load_details(refresh=True) mixins.add_tag(tag, single_value=single_value, navigate=True)
def test_tag_datastore(setup_infrastructure_providers, tag): """Add a tag to a datastore """ pytest.sel.force_navigate('infrastructure_datastores') Quadicon.select_first_quad() mixins.add_tag(tag)
def test_tag_vm(setup_infrastructure_providers, tag): """Add a tag to a vm """ pytest.sel.force_navigate('infrastructure_virtual_machines') Quadicon.select_first_quad() mixins.add_tag(tag)
def add_tag(self, tag, **kwargs): """Tags the Keypair by given tag""" navigate_to(self, 'Details') mixins.add_tag(tag, **kwargs)
def tag(self, tag): """Tags the system by given tag""" navigate_to(self, 'EditTags') fill(mixins.tag_form, {'category': 'Cost Center *', 'tag': 'Cost Center 001'}) # --- mixins.add_tag(tag, navigate=False)
def test_tag_vm(setup_first_cloud_provider, tag): """Add a tag to a vm """ pytest.sel.force_navigate('clouds_instances_by_provider') Quadicon.select_first_quad() mixins.add_tag(tag)
def test_tag_provider(setup_first_cloud_provider, tag): """Add a tag to a provider """ pytest.sel.force_navigate('clouds_providers') Quadicon.select_first_quad() mixins.add_tag(tag)
def test_tag_vm(setup_cloud_providers, tag): """Add a tag to a vm """ pytest.sel.force_navigate('clouds_instances') Quadicon.select_first_quad() mixins.add_tag(tag)
def tag(self, tag): """Tags the system by given tag""" navigate_to(self, "EditTags") fill(mixins.tag_form, {"category": "Cost Center *", "tag": "Cost Center 001"}) # --- mixins.add_tag(tag, navigate=False)