Ejemplo n.º 1
0
def test_control_crud_ansible_playbook_action(request, catalog_item):
    action = Action(
        fauxfactory.gen_alphanumeric(),
        action_type="Run Ansible Playbook",
        action_values={
            "run_ansible_playbook":
            {
                "playbook_catalog_item": catalog_item.name,
                "inventory": {
                    "target_machine": True
                }
            }
        }
    )
    action.create()
    request.addfinalizer(action.delete_if_exists)
    with update(action):
        ipaddr = fauxfactory.gen_ipaddr()
        new_descr = "edited_{}".format(fauxfactory.gen_alphanumeric())
        action.description = new_descr
        action.run_ansible_playbook = {
            "inventory": {
                "specific_hosts": True,
                "hosts": ipaddr
            }
        }
    view = navigate_to(action, "Edit")
    assert view.description.value == new_descr
    assert view.run_ansible_playbook.inventory.hosts.value == ipaddr
    action.delete()