|
| 1 | +import fauxfactory |
1 | 2 | import pytest |
2 | 3 |
|
3 | 4 | from cfme import test_requirements |
4 | 5 | from cfme.utils.appliance.implementations.ui import navigate_to |
| 6 | +from cfme.utils.rest import assert_response |
| 7 | +from cfme.utils.wait import wait_for |
5 | 8 |
|
6 | 9 | pytestmark = [test_requirements.rest, pytest.mark.tier(1)] |
7 | 10 |
|
@@ -33,3 +36,40 @@ def _reset_settings(): |
33 | 36 |
|
34 | 37 | view = navigate_to(appliance.server, "Advanced") |
35 | 38 | assert view.is_displayed |
| 39 | + |
| 40 | + |
| 41 | +@pytest.mark.meta(automates=[1805844]) |
| 42 | +@pytest.mark.parametrize("from_detail", [True, False], ids=["from_detail", "from_collection"]) |
| 43 | +def test_edit_region(temp_appliance_preconfig_funcscope, from_detail): |
| 44 | + """ |
| 45 | + Bugzilla: |
| 46 | + 1805844 |
| 47 | +
|
| 48 | + Polarion: |
| 49 | + assignee: pvala |
| 50 | + casecomponent: Configuration |
| 51 | + caseimportance: medium |
| 52 | + initialEstimate: 1/10h |
| 53 | + """ |
| 54 | + appliance = temp_appliance_preconfig_funcscope |
| 55 | + ui_region = appliance.server.zone.region |
| 56 | + view = navigate_to(ui_region, "Details") |
| 57 | + payload = { |
| 58 | + "description": fauxfactory.gen_alpha(start=f"Edited {ui_region.region_string} ", length=20) |
| 59 | + } |
| 60 | + expected_title = f'CFME Region "{payload["description"]} [{ui_region.number}]"' |
| 61 | + currently_selected = f'CFME Region: {payload["description"]} [{ui_region.number}]' |
| 62 | + |
| 63 | + region = ui_region.rest_api_entity |
| 64 | + if from_detail: |
| 65 | + region.action.edit(**payload) |
| 66 | + else: |
| 67 | + payload.update(region._ref_repr()) |
| 68 | + appliance.rest_api.collections.regions.action.edit(payload) |
| 69 | + |
| 70 | + assert_response(appliance) |
| 71 | + wait_for( |
| 72 | + lambda: region.description == payload["description"], fail_func=region.reload, timeout=30 |
| 73 | + ) |
| 74 | + wait_for(lambda: view.title.text == expected_title, fail_func=view.browser.refresh, timeout=800) |
| 75 | + assert currently_selected in view.accordions.settings.tree.currently_selected |
0 commit comments