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

Commit

Permalink
[WIPTEST] Automate: test_service_refresh_dialog_fields_default_values
Browse files Browse the repository at this point in the history
  • Loading branch information
valaparthvi committed Dec 17, 2019
1 parent 98f2bb7 commit 6bd3a30
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 39 deletions.
10 changes: 10 additions & 0 deletions cfme/automate/dialogs/service_dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from cfme.automate.dialogs import AutomateCustomizationView
from cfme.automate.dialogs import EditDialogView
from cfme.automate.dialogs.dialog_tab import TabCollection
from cfme.exceptions import RestLookupError
from cfme.modeling.base import BaseCollection
from cfme.modeling.base import BaseEntity
from cfme.utils.appliance.implementations.ui import CFMENavigateStep
Expand Down Expand Up @@ -89,6 +90,15 @@ def delete(self):
view.flash.assert_success_message(
'Dialog "{}": Delete successful'.format(self.label))

@property
def rest_api_entity(self):
try:
return self.appliance.rest_api.collections.service_dialogs.get(label=self.label)
except ValueError:
raise RestLookupError(
f"No service dialog rest entity found matching label {self.label}"
)


@attr.s
class DialogCollection(BaseCollection):
Expand Down
65 changes: 65 additions & 0 deletions cfme/tests/services/test_rest_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -2434,3 +2434,68 @@ def test_embedded_ansible_cat_item_edit_rest(appliance, request, ansible_catalog
service_template.reload()
assert service_template.name == new_data["name"]
assert service_template.description == new_data["description"]


@pytest.mark.meta(automates=[1730813])
@test_requirements.rest
@pytest.mark.customer_scenario
@pytest.mark.parametrize("file_name", ["testgear-dialog.yaml"], ids=[''])
def test_service_refresh_dialog_fields_default_values(
appliance, request, file_name, import_dialog, soft_assert
):
"""
Bugzilla:
1730813
1731977
Polarion:
assignee: pvala
caseimportance: high
casecomponent: Rest
initialEstimate: 1/4h
setup:
1. Import dialog `RTP Testgear Client Provision` from the BZ attachments and create
a service_template and service catalog to attach it.
testSteps:
1. Perform action `refresh_dialog_fields` by sending a request
POST /api/service_catalogs/<:id>/sevice_templates/<:id>
{
"action": "refresh_dialog_fields",
"resource": {
"fields": [
"tag_1_region",
"tag_0_function"
]
}
}
expectedResults:
1. Request must be successful and evm must have the default values
for the fields mentioned in testStep 1.
"""
dialog, _ = import_dialog
service_template = _service_templates(
request, appliance, service_dialog=dialog.rest_api_entity, num=1
)[0]

# We cannot directly call `refresh_dialog_fields` action from service_template, it has to be
# accessed via service_catalog.
service_catalog = appliance.rest_api.collections.service_catalogs.get(
id=service_template.service_template_catalog_id
)
service_catalog.service_templates.get(id=service_template.id).action.refresh_dialog_fields(
**{"fields": ["tag_1_region", "tag_0_function"]}
)
assert_response(appliance)

response = appliance.rest_api.response.json()["result"]
expected_tag_1_region = [["rtp", "rtp-vaas-vc.cisco.com"]]
expected_tag_0_function = [["ixia", "IXIA"]]

soft_assert(
expected_tag_1_region == response["tag_1_region"]["values"],
"Default values for 'tag_1_region' did not match.",
)
soft_assert(
expected_tag_0_function == response["tag_0_function"]["values"],
"Default values for 'tag_0_function' did not match.",
)
39 changes: 0 additions & 39 deletions cfme/tests/test_rest_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,45 +88,6 @@ def test_widget_generate_content_via_rest(context):
pass


@pytest.mark.meta(coverage=[1730813])
@pytest.mark.tier(2)
@test_requirements.rest
@pytest.mark.customer_scenario
def test_service_refresh_dialog_fields_default_values():
"""
Bugzilla:
1730813
1731977
Polarion:
assignee: pvala
caseimportance: high
casecomponent: Rest
initialEstimate: 1/4h
setup:
1. Import dialog `RTP Testgear Client Provision` from the BZ attachments and create
a service_template and service catalog to attach it.
testSteps:
1. Start monitoring the evm log and look for fields `tag_1_region` and `tag_0_function`.
2. Perform action `refresh_dialog_fields` by sending a request
POST /api/service_catalogs/<:id>/sevice_templates/<:id>
{
"action": "refresh_dialog_fields",
"resource": {
"fields": [
"tag_1_region",
"tag_0_function"
]
}
}
expectedResults:
1.
2. Request must be successful and evm must have the default values
for the fields mentioned in testStep 1.
"""
pass


@pytest.mark.tier(2)
@pytest.mark.meta(coverage=[1486765, 1740340])
@pytest.mark.parametrize(
Expand Down

0 comments on commit 6bd3a30

Please sign in to comment.