This repository has been archived by the owner on Apr 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 165
[1LP][RFR] Rewrite of test_infrastructure_hosts_crud for only single hosts #9761
Merged
Merged
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
b8712f8
Create draft of rewrite of test_infrastructure_hosts_crud to edit onl…
prichard77 3c10cdf
Add check for reset flash banner and edit from details view
prichard77 116c070
Clean up comments
prichard77 faa6e17
Fix flake8 issues
prichard77 6226e89
Reorder imports
prichard77 e625b57
Removing outdated BZ lable
prichard77 97e722e
Use fauxfactory instead of datetime to generate a unique string for v…
prichard77 cb2ca37
Add newline before comments and remove remaining usage of datetime
prichard77 9e44461
Add from_details kwarg to host.update
prichard77 1255296
Update host.update nav to support edit from hosts view
prichard77 00bdd96
Rewrite test_infrastructure_hosts_crud utilizing parameterization for…
prichard77 a23d7e2
Add cancel_button and is_displayed to host edit view
prichard77 836eebb
Update Host.update to support edit from hosts view
prichard77 f9dc67f
Put view.is_displayed back into Host.update()
prichard77 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
import random | ||
import socket | ||
|
||
import fauxfactory | ||
import pytest | ||
from wait_for import TimedOutError | ||
from widgetastic.exceptions import UnexpectedAlertPresentException | ||
|
||
from cfme import test_requirements | ||
from cfme.base.credential import Credential | ||
from cfme.common.host_views import HostsCompareView | ||
from cfme.common.host_views import HostsEditView | ||
from cfme.common.host_views import ProviderHostsCompareView | ||
from cfme.common.provider_views import InfraProviderDetailsView | ||
from cfme.common.provider_views import InfraProvidersView | ||
from cfme.common.provider_views import ProviderNodesView | ||
from cfme.fixtures.provider import setup_or_skip | ||
from cfme.infrastructure.provider import InfraProvider | ||
|
@@ -541,28 +540,29 @@ def test_add_ipmi_refresh(appliance, setup_provider): | |
|
||
|
||
@test_requirements.infra_hosts | ||
@pytest.mark.parametrize("num_hosts", [1, 2, 4]) | ||
@pytest.mark.meta(blockers=[BZ(1634794, forced_streams=["5.10"])], automates=[1634794]) | ||
def test_infrastructure_hosts_crud(appliance, setup_provider_min_hosts, provider, num_hosts): | ||
@pytest.mark.parametrize("crud_action", ['edit_from_hosts', 'edit_from_details', 'remove']) | ||
def test_infrastructure_hosts_crud(appliance, setup_provider, provider, crud_action): | ||
""" | ||
Polarion: | ||
assignee: prichard | ||
casecomponent: Infra | ||
caseimportance: low | ||
initialEstimate: 1/6h | ||
Bugzilla: | ||
1634794 | ||
""" | ||
my_slice = slice(0, num_hosts, None) | ||
hosts_view = navigate_to(provider.collections.hosts, "All") | ||
for h in hosts_view.entities.get_all(slice=my_slice): | ||
h.ensure_checked() | ||
hosts_view.toolbar.configuration.item_select('Edit Selected items', | ||
handle_alert=False) | ||
try: | ||
hosts_view.navigation.select('Compute', 'Infrastructure', 'Providers', handle_alert=False) | ||
final_view = provider.create_view(InfraProvidersView) | ||
assert final_view.is_displayed | ||
except UnexpectedAlertPresentException: | ||
pytest.fail("Abandon changes alert displayed, but no changes made.") | ||
# TODO add additional crud functionality. | ||
from cfme.utils.update import update | ||
|
||
host = appliance.collections.hosts.all()[0] | ||
if crud_action != 'remove': | ||
stamp = fauxfactory.gen_alphanumeric() | ||
new_custom_id = f'Edit host data. {stamp}' | ||
|
||
# with update(host, from_details=lambda crud_action: crud_action=='edit_from_details'): | ||
with update(host, from_details=(crud_action == 'edit_from_details')): | ||
host.custom_ident = new_custom_id | ||
|
||
assert host.custom_ident == new_custom_id | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't trust the |
||
assert navigate_to(host, 'Details').entities.summary("Properties").get_text_of( | ||
"Custom Identifier") == new_custom_id | ||
else: | ||
host.delete() | ||
host.delete(cancel=False) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you move this to the top of the file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done