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_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 test_compressed_view(request, setup_a_provider, key): name = re.split(r"\/", key) default_view = get_default_view(name[0]) set_compressed_view(name[0]) sel.force_navigate(name[1]) Quadicon.select_first_quad() select_second_quad() tb.select(name[2], name[3]) assert tb.is_active('Compressed View'), "Compressed view setting failed" reset_default_view(name[0], default_view)
def test_exists_view(request, setup_a_provider, key): name = re.split(r"\/", key) button_name = name[0] + " Mode" default_view = get_default_view(button_name) set_exist_view(button_name) sel.force_navigate(name[1]) Quadicon.select_first_quad() select_second_quad() tb.select(name[2], name[3]) assert tb.is_active('Exists Mode'), "Exists view setting failed" reset_default_view(button_name, default_view)
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 _delete(): # Ignoring the result of the check here _navigate_and_check(location) Quadicon.select_first_quad() mixins.remove_tag(tag)
def _delete(): pytest.sel.force_navigate(location) tb.select('Grid View') Quadicon.select_first_quad() mixins.remove_tag(tag)
def select_first_provider_and_get_its_name(): navigate_to(ContainersProvider, 'All') tb.select('Grid View') Quadicon.select_first_quad() return Quadicon.get_first_quad_title()
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 select_first_provider_and_get_its_name(): navigate_to(ContainersProvider, 'All') tb.select('Grid View') Quadicon.select_first_quad() return Quadicon.get_first_quad_title()
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 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 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 _delete(): pytest.sel.force_navigate(location) tb.set_vms_grid_view() Quadicon.select_first_quad() mixins.remove_tag(tag)
def _delete(): pytest.sel.force_navigate(location) tb.set_vms_grid_view() Quadicon.select_first_quad() mixins.remove_tag(tag)