Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Commit

Permalink
[RFR]v2v edit mapping fields (#8256)
Browse files Browse the repository at this point in the history
* v2v edit mapping fields

* v2v edit mapping fields

* v2v edit mapping test case
  • Loading branch information
sshveta authored and mshriver committed Dec 13, 2018
1 parent 7729da9 commit ea70ac6
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 37 deletions.
23 changes: 23 additions & 0 deletions cfme/fixtures/v2v.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,29 @@ def form_data_single_network(request, second_provider, provider):
return form_data


@pytest.fixture(scope='function')
def edited_form_data(second_provider, provider):
form_data = _form_data(second_provider, provider)
edited_form_data = {
'general': {
'description': "my edited description"},
'cluster': {},
'datastore': {
'Cluster ({})'.format(provider.data.get('clusters')[0]): {
'mappings': [_form_data_mapping('datastores', second_provider, provider,
'iscsi', 'iscsi')]
}
},
'network': {
'Cluster ({})'.format(provider.data.get('clusters')[0]): {
'mappings': [_form_data_mapping('vlans', second_provider, provider,
'DPortGroup', 'Storage - VLAN 33')]
}
}
}
return form_data, edited_form_data


@pytest.fixture(scope='function')
def form_data_dual_vm_obj_dual_datastore(request, appliance, second_provider, provider):
vmware_nw = second_provider.data.get('vlans', [None])[0]
Expand Down
23 changes: 12 additions & 11 deletions cfme/tests/v2v/test_v2v_migrations_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,21 +427,22 @@ def test_migration_rbac(appliance, new_credential, v2v_providers):


@pytest.mark.ignore_stream("5.9")
@pytest.mark.parametrize('form_data_single_datastore', [['nfs', 'nfs']], indirect=True)
def test_edit_mapping_description(appliance, v2v_providers, form_data_single_datastore,
host_creds, conversion_tags, soft_assert):
def test_edit_mapping_fields(appliance, v2v_providers, edited_form_data,
host_creds, conversion_tags, soft_assert):
_form_data, edited_form_data = edited_form_data
infrastructure_mapping_collection = appliance.collections.v2v_mappings
mapping = infrastructure_mapping_collection.create(form_data_single_datastore)
edited_form_data = {
'general': {
'description': "my edited description"},
'cluster': {},
'datastore': {},
'network': {}
}
mapping = infrastructure_mapping_collection.create(_form_data)
mapping.update(edited_form_data)

view = navigate_to(infrastructure_mapping_collection, 'All')
infrastructure_mapping_collection.find_mapping(mapping)
mapping_list = view.infra_mapping_list
soft_assert(str(mapping_list.get_map_description(mapping.name)) == "my edited description")
soft_assert(edited_form_data['datastore'].values()[0]['mappings'][0]['sources'][0].format() in
mapping_list.get_map_source_datastores(mapping.name)[1])
soft_assert(edited_form_data['datastore'].values()[0]['mappings'][0]['target'][0].format() in
mapping_list.get_map_target_datastores(mapping.name)[1])
soft_assert(edited_form_data['network'].values()[0]['mappings'][0]['sources'][0].format() in
mapping_list.get_map_source_networks(mapping.name)[1])
soft_assert(edited_form_data['network'].values()[0]['mappings'][0]['target'][0].format() in
mapping_list.get_map_target_networks(mapping.name)[1])
49 changes: 23 additions & 26 deletions cfme/v2v/migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,31 +66,38 @@ class v2vPaginatorPane(View):
items_on_page = v2vPaginationDropup('id', 'pagination-row-dropdown')
paginator = v2vPaginator()


# Views
class InfraMappingWizardCommon(View):

add_mapping = Button('Add Mapping')
remove_mapping = Button('Remove Selected')
remove_all_mappings = Button('Remove All')
mappings_tree = InfraMappingTreeView(tree_class='treeview')


class InfraMappingFormControlButtons(View):
class InfraMappingForm(View):
# common footer buttons for first 3 pages
back_btn = Button('Back')
next_btn = Button('Next')
save = Button('Save')
cancel_btn = Button('Cancel')


class InfraMappingWizardCommon(View):

add_mapping = Button('Add Mapping')
remove_mapping = Button('Remove Selected')
remove_all_mappings = Button('Remove All')
mappings_tree = InfraMappingTreeView(tree_class='treeview')
def after_fill(self, was_change):
# Cancel button is the common button on all pages so
# waiting for footer buttons to display
self.cancel_btn.wait_displayed()
if self.next_btn.is_displayed:
self.next_btn.click()
elif self.save.is_displayed:
self.save.click()


class InfraMappingWizardGeneralView(View):
class InfraMappingWizardGeneralView(InfraMappingForm):
name = TextInput(name='name')
description = TextInput(name='description')
name_help_text = Text(locator='.//div[contains(@id,"name")]/span')
description_help_text = Text(locator='.//div[contains(@id,"description")]/span')
include_buttons = View.include(InfraMappingFormControlButtons)

def after_fill(self, was_change):
if was_change:
Expand All @@ -101,8 +108,7 @@ def is_displayed(self):
return self.name.is_displayed and self.description.is_displayed


class InfraMappingWizardClustersView(View):
include_buttons_set1 = View.include(InfraMappingFormControlButtons)
class InfraMappingWizardClustersView(InfraMappingForm):
include_buttons_set2 = View.include(InfraMappingWizardCommon)
source_clusters = MultiSelectList('source_clusters')
target_clusters = MultiSelectList('target_clusters')
Expand Down Expand Up @@ -132,12 +138,11 @@ def fill(self, values):
self.target_clusters.fill(mapping['target'])
self.add_mapping.click()
was_change = not self.mappings_tree.is_empty
self.next_btn.click()
self.after_fill(was_change)
return was_change


class InfraMappingWizardDatastoresView(View):
include_buttons_set1 = View.include(InfraMappingFormControlButtons)
class InfraMappingWizardDatastoresView(InfraMappingForm):
include_buttons_set2 = View.include(InfraMappingWizardCommon)
source_datastores = MultiSelectList('source_datastores')
target_datastores = MultiSelectList('target_datastores')
Expand Down Expand Up @@ -174,13 +179,11 @@ def fill(self, values):
self.target_datastores.fill(mapping['target'])
self.add_mapping.click()
was_change = not self.mappings_tree.is_empty
self.next_btn.wait_displayed()
self.next_btn.click()
self.after_fill(was_change)
return was_change


class InfraMappingWizardNetworksView(View):
include_buttons_set1 = View.include(InfraMappingFormControlButtons)
class InfraMappingWizardNetworksView(InfraMappingForm):
include_buttons_set2 = View.include(InfraMappingWizardCommon)
source_networks = MultiSelectList('source_networks')
target_networks = MultiSelectList('target_networks')
Expand Down Expand Up @@ -218,13 +221,7 @@ def fill(self, values):
self.target_networks.fill(mapping['target'])
self.add_mapping.click()
was_change = not self.mappings_tree.is_empty
# Cancel button is the common button on all pages so
# waiting for footer buttons to display
self.cancel_btn.wait_displayed()
if self.next_btn.is_displayed:
self.next_btn.click()
elif self.save.is_displayed:
self.save.click()
self.after_fill(was_change)
return was_change


Expand Down
Empty file added cfme/v2v/migrations_new.py
Empty file.

0 comments on commit ea70ac6

Please sign in to comment.