Exemplo n.º 1
0
    def test_create_uppercase_user(self, request, appliance):
        """Tests creating user with userid containing uppercase letters.

        Testing BZ 1486041

        Metadata:
            test_flag: rest

        Polarion:
            assignee: pvala
            casecomponent: Rest
            caseimportance: low
            initialEstimate: 1/4h
        """
        uniq = fauxfactory.gen_alphanumeric(4).upper()
        data = {
            "userid": "rest_{}".format(uniq),
            "name": "REST User {}".format(uniq),
            "password": fauxfactory.gen_alphanumeric(),
            "email": "*****@*****.**",
            "group": {"description": "EvmGroup-user_self_service"}
        }

        user = _creating_skeleton(request, appliance, 'users', [data])[0]
        assert_response(appliance)
        user_auth = (user.userid, data['password'])
        assert appliance.new_rest_api_instance(auth=user_auth)
Exemplo n.º 2
0
    def test_create_uppercase_user(self, request, appliance):
        """Tests creating user with userid containing uppercase letters.

        Testing BZ 1486041

        Metadata:
            test_flag: rest

        Polarion:
            assignee: pvala
            casecomponent: Rest
            caseimportance: low
            initialEstimate: 1/4h
        """
        uniq = fauxfactory.gen_alphanumeric(4).upper()
        data = {
            "userid": "rest_{}".format(uniq),
            "name": "REST User {}".format(uniq),
            "password": fauxfactory.gen_alphanumeric(),
            "email": "*****@*****.**",
            "group": {"description": "EvmGroup-user_self_service"}
        }

        user = _creating_skeleton(request, appliance, 'users', [data])[0]
        assert_response(appliance)
        user_auth = (user.userid, data['password'])
        assert appliance.new_rest_api_instance(auth=user_auth)
    def user_auth(self, request, appliance):
        password = fauxfactory.gen_alphanumeric()
        data = [{
            "userid": "rest_{}".format(fauxfactory.gen_alphanumeric(3).lower()),
            "name": "REST User {}".format(fauxfactory.gen_alphanumeric()),
            "password": password,
            "email": "*****@*****.**",
            "group": {"description": "EvmGroup-user_self_service"}
        }]

        user = _creating_skeleton(request, appliance.rest_api, 'users', data)[0]
        assert_response(appliance)
        return user.userid, password
    def user_auth(self, request, appliance):
        password = fauxfactory.gen_alphanumeric()
        data = [{
            "userid": "rest_{}".format(fauxfactory.gen_alphanumeric(3).lower()),
            "name": "REST User {}".format(fauxfactory.gen_alphanumeric()),
            "password": password,
            "email": "*****@*****.**",
            "group": {"description": "EvmGroup-user_self_service"}
        }]

        user = _creating_skeleton(request, appliance.rest_api, 'users', data)[0]
        assert_response(appliance)
        return user.userid, password
    def user_auth(self, request, appliance, new_group):
        password = fauxfactory.gen_alphanumeric()
        data = [{
            "userid":
            "rest_{}".format(fauxfactory.gen_alphanumeric(3).lower()),
            "name":
            "REST User {}".format(fauxfactory.gen_alphanumeric()),
            "password":
            password,
            "group": {
                "id": new_group.id
            }
        }]

        user = _creating_skeleton(request, appliance.rest_api, 'users', data)
        user = user[0]
        return user.userid, password
Exemplo n.º 6
0
def ansible_tower_dialog_rest(request, appliance):
    """Creates service dialog using REST API."""
    uid = fauxfactory.gen_alphanumeric()
    data = {
        "description": "my ansible dialog {}".format(uid),
        "buttons": "submit,cancel",
        "label": uid,
        "dialog_tabs": [
            {
                "description": "Basic Information",
                "display": "edit",
                "label": "Basic Information",
                "position": 0,
                "dialog_groups": [
                    {
                        "description": "Basic 1",
                        "display": "edit",
                        "label": "Options",
                        "position": 0,
                        "dialog_fields": [
                            {
                                "name": "service_name",
                                "description": "Name of the new service",
                                "data_type": "string",
                                "display": "edit",
                                "required": False,
                                "default_value": uid,
                                "options": {
                                    "protected": False
                                },
                                "label": "Service Name",
                                "position": 0,
                                "reconfigurable": True,
                                "visible": True,
                                "type": "DialogFieldTextBox",
                                "resource_action": {
                                    "resource_type": "DialogField"
                                }
                            },
                            {
                                "name": "limit",
                                "description": "A",
                                "data_type": "string",
                                "display": "edit",
                                "required": False,
                                "options": {
                                    "protected": False
                                },
                                "label": "Limit",
                                "position": 1,
                                "reconfigurable": True,
                                "visible": True,
                                "type": "DialogFieldTextBox",
                                "resource_action": {
                                    "resource_type": "DialogField"
                                }
                            }
                        ]
                    },
                    {
                        "description": "Basic 2",
                        "display": "edit",
                        "label": "Survey",
                        "position": 1,
                        "dialog_fields": [
                            {
                                "name": "param_Department",
                                "description": "",
                                "display": "edit",
                                "required": True,
                                "default_value": "QE",
                                "values": [
                                    [
                                        "HR",
                                        "HR"
                                    ],
                                    [
                                        "PM",
                                        "PM"
                                    ],
                                    [
                                        "QE",
                                        "QE"
                                    ]
                                ],
                                "options": {},
                                "label": "Survey",
                                "position": 0,
                                "reconfigurable": True,
                                "visible": True,
                                "type": "DialogFieldDropDownList",
                                "resource_action": {
                                    "resource_type": "DialogField"
                                }
                            }
                        ]
                    }
                ]
            }
        ]
    }

    service_dialog = _creating_skeleton(request, appliance, "service_dialogs",
        [data])
    return service_dialog[0]
def ansible_tower_dialog_rest(request, appliance):
    """Creates service dialog using REST API."""
    uid = fauxfactory.gen_alphanumeric()
    data = {
        "description":
        f"my ansible dialog {uid}",
        "buttons":
        "submit,cancel",
        "label":
        uid,
        "dialog_tabs": [{
            "description":
            "Basic Information",
            "display":
            "edit",
            "label":
            "Basic Information",
            "position":
            0,
            "dialog_groups": [{
                "description":
                "Basic 1",
                "display":
                "edit",
                "label":
                "Options",
                "position":
                0,
                "dialog_fields": [{
                    "name": "service_name",
                    "description": "Name of the new service",
                    "data_type": "string",
                    "display": "edit",
                    "required": False,
                    "default_value": uid,
                    "options": {
                        "protected": False
                    },
                    "label": "Service Name",
                    "position": 0,
                    "reconfigurable": True,
                    "visible": True,
                    "type": "DialogFieldTextBox",
                    "resource_action": {
                        "resource_type": "DialogField"
                    }
                }, {
                    "name": "limit",
                    "description": "A",
                    "data_type": "string",
                    "display": "edit",
                    "required": False,
                    "options": {
                        "protected": False
                    },
                    "label": "Limit",
                    "position": 1,
                    "reconfigurable": True,
                    "visible": True,
                    "type": "DialogFieldTextBox",
                    "resource_action": {
                        "resource_type": "DialogField"
                    }
                }]
            }, {
                "description":
                "Basic 2",
                "display":
                "edit",
                "label":
                "Survey",
                "position":
                1,
                "dialog_fields": [{
                    "name":
                    "param_Department",
                    "description":
                    "",
                    "display":
                    "edit",
                    "required":
                    True,
                    "default_value":
                    "QE",
                    "values": [["HR", "HR"], ["PM", "PM"], ["QE", "QE"]],
                    "options": {},
                    "label":
                    "Survey",
                    "position":
                    0,
                    "reconfigurable":
                    True,
                    "visible":
                    True,
                    "type":
                    "DialogFieldDropDownList",
                    "resource_action": {
                        "resource_type": "DialogField"
                    }
                }]
            }]
        }]
    }

    service_dialog = _creating_skeleton(request, appliance, "service_dialogs",
                                        [data])
    return service_dialog[0]