Beispiel #1
0
def test_custom_button_on_catalog_item_crud(generic_catalog_item):
    """
    Polarion:
        assignee: ndhandre
        initialEstimate: 1/8h
        caseimportance: medium
        caseposneg: positive
        testtype: functional
        startsin: 5.9
        casecomponent: CustomButton
        tags: custom_button
        testSteps:
            1. Add catalog_item
            2. Goto catalog detail page and select `add group` from toolbar
            3. Fill info and save button
            4. Delete created button group
    Bugzilla:
        1687289
    """
    btn_data = {
        "text": gen_numeric_string(start="btn_"),
        "hover": gen_numeric_string(15, start="btn_hvr_"),
        "image": "fa-user",
    }

    btn = generic_catalog_item.add_button(**btn_data)
    view = generic_catalog_item.create_view(DetailsCatalogItemView)
    view.flash.assert_message('Custom Button "{}" was added'.format(btn_data["hover"]))
    assert generic_catalog_item.button_exists(btn)

    generic_catalog_item.delete_button(btn)
    # TODO(BZ-1687289): add deletion flash assertion as BZ fix.
    assert not generic_catalog_item.button_exists(btn)
Beispiel #2
0
def test_catalog_item_copy_with_custom_buttons(request, generic_catalog_item):
    """
    Bugzilla:
        1740556

    Polarion:
        assignee: ndhandre
        initialEstimate: 1/4h
        caseimportance: high
        caseposneg: positive
        startsin: 5.11
        casecomponent: CustomButton
        tags: custom_button
        testSteps:
            1. Add catalog_item
            2. Add custom button over catalog item
            3. Copy catalog item
            4. Check for button on copied catalog item
    """
    # add button on catalog item
    btn_data = {
        "text": gen_numeric_string(start="button_"),
        "hover": gen_numeric_string(start="hover_"),
        "image": "fa-user",
    }

    btn = generic_catalog_item.add_button(**btn_data)

    # copy catalog item
    new_cat_item = generic_catalog_item.copy()
    request.addfinalizer(new_cat_item.delete_if_exists)

    # check for catalog item and button on copied
    assert new_cat_item.exists
    assert new_cat_item.button_exists(btn)
def test_custom_button_on_catalog_item_crud(generic_catalog_item):
    """
    Polarion:
        assignee: ndhandre
        initialEstimate: 1/8h
        caseimportance: medium
        caseposneg: positive
        testtype: functional
        startsin: 5.9
        casecomponent: CustomButton
        tags: custom_button
        testSteps:
            1. Add catalog_item
            2. Goto catalog detail page and select `add group` from toolbar
            3. Fill info and save button
            4. Delete created button group
    Bugzilla:
        1687289
    """
    btn_data = {
        "text": "button_{}".format(gen_numeric_string(3)),
        "hover": "hover_{}".format(gen_numeric_string(3)),
        "image": "fa-user",
    }

    btn = generic_catalog_item.add_button(**btn_data)
    view = generic_catalog_item.create_view(DetailsCatalogItemView)
    view.flash.assert_message('Custom Button "{}" was added'.format(btn_data["hover"]))
    assert generic_catalog_item.button_exists(btn)

    generic_catalog_item.delete_button(btn)
    # TODO(BZ-1687289): add deletion flash assertion as BZ fix.
    assert not generic_catalog_item.button_exists(btn)
Beispiel #4
0
    def test_gen_numeric_string_8(self):
        """
        @Test: Create numeric string with alpha string length
        @Feature: String Generator
        @Assert: Numeric string is not created due to value error
        """

        with self.assertRaises(ValueError):
            gen_numeric_string(length='a')
Beispiel #5
0
    def test_gen_numeric_string_8(self):
        """
        @Test: Create numeric string with alpha string length
        @Feature: String Generator
        @Assert: Numeric string is not created due to value error
        """

        with self.assertRaises(ValueError):
            gen_numeric_string(length='a')
Beispiel #6
0
    def test_gen_alpha_3_4(self):
        """
        @Test: Create alpha string with zero length
        @Feature: String Generator
        @Assert: String is not created due to value error
        """

        with self.assertRaises(ValueError):
            gen_numeric_string(length=0)
Beispiel #7
0
    def test_gen_alpha_3_4(self):
        """
        @Test: Create alpha string with zero length
        @Feature: String Generator
        @Assert: String is not created due to value error
        """

        with self.assertRaises(ValueError):
            gen_numeric_string(length=0)
def test_custom_group_on_generic_class_crud(appliance, generic_definition):
    """ Test custom button group crud operation on generic class definition

    Bugzilla:
        1744478
        1753289

    Polarion:
        assignee: tpapaioa
        initialEstimate: 1/8h
        caseimportance: critical
        startsin: 5.10
        casecomponent: CustomButton
        testSteps:
            1. Create custom button group on generic class
            2. Update custom button group by editing
            3. Delete custom button group
    """

    with appliance.context.use(ViaUI):
        # create group
        group = generic_definition.collections.generic_object_groups_buttons.create(
            name=fauxfactory.gen_numeric_string(13,
                                                start="btn_group",
                                                separator="-"),
            description=fauxfactory.gen_alphanumeric(start="disc",
                                                     separator="-"),
            image="fa-user",
        )
        view = appliance.browser.create_view(
            GenericObjectDefinitionDetailsView)
        view.flash.assert_success_message(
            f'Custom Button Group "{group.name}" has been successfully added.')
        assert group.exists

        # update group
        with update(group):
            group.name = fauxfactory.gen_numeric_string(13,
                                                        start="btn_group",
                                                        separator="-")
            group.description = fauxfactory.gen_alphanumeric(start="disc",
                                                             separator="-")
        view.flash.assert_success_message(
            f'Custom Button Group "{group.name}" has been successfully saved.')
        assert group.exists

        # delete group
        group.delete()
        if not (BZ(1744478).blocks or BZ(1773666).blocks):
            view.flash.assert_success_message(
                f'CustomButtonSet: "{group.name}" was successfully deleted')
        else:
            view.flash.assert_success_message(
                'Button Group:"undefined" was successfully deleted')
        assert not group.exists
Beispiel #9
0
 def test_properties(self, gen_image):
     # Just test that there are no errors when we try to get properties
     if MOCKED:
         gen_image.api.get.return_value = [
             200, {
                 'dockerImageReference':
                 'this.is.some.fake/registry:{}'
                 '@sha256:some-long-fake-id-with-numbers-{}'.format(
                     fauxfactory.gen_numeric_string(3),
                     fauxfactory.gen_numeric_string(64))
             }
         ]
     gen_image.registry, gen_image.tag
Beispiel #10
0
def test_service_rbac_orchestration(appliance, role_user_group):
    """ Test service rbac with orchestration

    Polarion:
        assignee: None
        initialEstimate: None
    """
    role, user = role_user_group
    product_features = [(['Everything'], True), (['Everything'], False)]
    product_features.extend([
        (['Everything', 'Services', 'Catalogs Explorer', k], True)
        for k in ['Orchestration Templates']
    ])
    role.update({'product_features': product_features})
    with user:
        appliance.server.login(user)
        collection = appliance.collections.orchestration_templates
        template = collection.create(
            template_name=fauxfactory.gen_alphanumeric(),
            template_type='Amazon CloudFormation',
            template_group='CloudFormation Templates',
            description='template description',
            content=fauxfactory.gen_numeric_string())
        assert template.exists
        template.delete()
def objects(appliance, definition, service):
    with appliance.context.use(ViaREST):
        instance = appliance.collections.generic_objects.create(
            name="generic_instance_{}".format(fauxfactory.gen_numeric_string(3)),
            definition=definition,
            attributes={"addr01": "Test Address"},
            associations={"services": [service]},
        )
        service.action.add_resource(
            resource=appliance.rest_api.collections.generic_objects.find_by(name=instance.name)[
                0
            ]._ref_repr()
        )
        instance.my_service = MyService(appliance, name=service.name)

        obj_dest = {
            "GENERIC": {
                "All": (instance.my_service, "GenericObjectInstance"),
                "Details": (instance, "MyServiceDetails"),
            },
            "SERVICE": {
                "All": (instance.my_service, "All"),
                "Details": (instance.my_service, "Details"),
            },
        }
        yield obj_dest
        if instance.exists:
            instance.delete()
def service(appliance):
    service_name = "service_{}".format(fauxfactory.gen_numeric_string(3))
    service = appliance.rest_api.collections.services.action.create(
        name=service_name, display=True
    )[0]
    yield service
    service.action.delete()
def service(appliance):
    service_name = "service_{}".format(fauxfactory.gen_numeric_string(3))
    service = appliance.rest_api.collections.services.action.create(
        name=service_name, display=True
    )[0]
    yield service
    service.action.delete()
def objects(appliance, definition, service):
    with appliance.context.use(ViaREST):
        instance = appliance.collections.generic_objects.create(
            name="generic_instance_{}".format(fauxfactory.gen_numeric_string(3)),
            definition=definition,
            attributes={"addr01": "Test Address"},
            associations={"services": [service]},
        )
        service.action.add_resource(
            resource=appliance.rest_api.collections.generic_objects.find_by(name=instance.name)[
                0
            ]._ref_repr()
        )
        instance.my_service = MyService(appliance, name=service.name)

        obj_dest = {
            "GENERIC": {
                "All": (instance.my_service, "GenericObjectInstance"),
                "Details": (instance, "MyServiceDetails"),
            },
            "SERVICE": {
                "All": (instance.my_service, "All"),
                "Details": (instance.my_service, "Details"),
            },
        }
        yield obj_dest
        if instance.exists:
            instance.delete()
Beispiel #15
0
def gen_docker_image_reference():
    """Generating a docker image reference including image ID.
    returns the docker image reference and image ID"""
    image_id = 'sha256:some-long-fake-id-with-numbers-{}'
    docker_image_refrence = 'this.is.some.fake.{}/registry:{}@{}'.format(
        fauxfactory.gen_alpha().lower(), fauxfactory.gen_numeric_string(3),
        image_id)
    return docker_image_refrence, image_id
def test_add_button(catalog_item, appliance):
    """
    Polarion:
        assignee: nansari
        initialEstimate: 1/4h
        casecomponent: Services
        tags: service
    """
    btn_data = {
        "text": fauxfactory.gen_numeric_string(start="btn_"),
        "hover": fauxfactory.gen_numeric_string(15, start="btn_hvr_"),
        "image": "fa-user",
    }
    catalog_item.add_button(**btn_data)
    view = appliance.browser.create_view(BaseLoggedInPage)
    message = f'Custom Button "{btn_data["hover"]}" was added'
    view.flash.assert_success_message(message)
def button_group(appliance, generic_definition):
    with appliance.context.use(ViaUI):
        group = generic_definition.collections.generic_object_groups_buttons.create(
            name=fauxfactory.gen_numeric_string(13, start="btn_group", separator="-"),
            description=fauxfactory.gen_alphanumeric(start="disc", separator="-"),
            image="fa-user",
        )
        yield group
        group.delete_if_exists()
Beispiel #18
0
    def test_gen_numeric_string_1(self):
        """
        @Test: Create numeric string of varied length
        @Feature: String Generator
        @Assert: Latin1 string is not created due to value error
        """

        result = gen_numeric_string()
        self.assertTrue(len(result) > 0, "Empty string was generated")
Beispiel #19
0
    def test_gen_numeric_string_1(self):
        """
        @Test: Create numeric string of varied length
        @Feature: String Generator
        @Assert: Latin1 string is not created due to value error
        """

        result = gen_numeric_string()
        self.assertTrue(
            len(result) > 0, "Empty string was generated")
Beispiel #20
0
    def test_gen_url_11(self):
        """
        @Test: Create a random URL with numeric TLDS
        @Feature: URL Generator
        @Assert: URL should not be created
        """

        for turn in range(10):
            with self.assertRaises(ValueError):
                tlds = gen_numeric_string(length=3)
                gen_url(tlds=tlds)
Beispiel #21
0
    def test_gen_url_11(self):
        """
        @Test: Create a random URL with numeric TLDS
        @Feature: URL Generator
        @Assert: URL should not be created
        """

        for turn in range(10):
            with self.assertRaises(ValueError):
                tlds = gen_numeric_string(length=3)
                gen_url(tlds=tlds)
Beispiel #22
0
def generic_object_definition(appliance):
    # Creating generic object using REST
    with appliance.context.use(ViaREST):
        definition = appliance.collections.generic_object_definitions.create(
            name="LoadBalancer_{}".format(fauxfactory.gen_numeric_string(3)),
            description="LoadBalancer",
            attributes={"location": "string"},
            associations={"vms": "Vm", "services": "Service"}
        )
        yield definition
        definition.delete_if_exists()
Beispiel #23
0
    def test_gen_numeric_string_2(self):
        """
        @Test: Create numeric string of fixed length
        @Feature: String Generator
        @Assert: Numeric string is created
        """

        for length in range(2, 12, 2):
            result = gen_numeric_string(length)
            self.assertEqual(
                len(result), length,
                "Generate string does not have the expected length")
def definition(appliance):
    with appliance.context.use(ViaREST):
        definition = appliance.collections.generic_object_definitions.create(
            name="generic_class_{}".format(fauxfactory.gen_numeric_string(3)),
            description="Generic Object Definition",
            attributes={"addr01": "string"},
            associations={"services": "Service"},
            methods=["add_vm", "remove_vm"],
        )
        yield definition
        if definition.exists:
            definition.delete()
def definition(appliance):
    with appliance.context.use(ViaREST):
        definition = appliance.collections.generic_object_definitions.create(
            name="generic_class_{}".format(fauxfactory.gen_numeric_string(3)),
            description="Generic Object Definition",
            attributes={"addr01": "string"},
            associations={"services": "Service"},
            methods=["add_vm", "remove_vm"],
        )
        yield definition
        if definition.exists:
            definition.delete()
Beispiel #26
0
def gen_rest_service(appliance):
    """Simple service create with rest for generic object association"""

    rest_service = appliance.rest_api.collections.services.action.create(
        name=fauxfactory.gen_numeric_string(16,
                                            start="gen_rest_serv",
                                            separator="-"),
        display=True)[0]

    yield rest_service
    if rest_service.exists:
        rest_service.action.delete()
def serv_button_group(appliance, request):

    with appliance.context.use(ViaUI):
        collection = appliance.collections.button_groups
        button_gp = collection.create(
            text=fauxfactory.gen_numeric_string(start="grp_"),
            hover=fauxfactory.gen_alphanumeric(15, start="grp_hvr_"),
            display=TEXT_DISPLAY[request.param]["group_display"],
            type=getattr(collection, "SERVICE"),
        )

        button = button_gp.buttons.create(
            text=fauxfactory.gen_numeric_string(start="btn_"),
            hover=fauxfactory.gen_alphanumeric(15, start="btn_hvr_"),
            display=TEXT_DISPLAY[request.param]["btn_display"],
            display_for="Single and list",
            system="Request",
            request="InspectMe",
        )
        yield button, button_gp
        button.delete_if_exists()
        button_gp.delete_if_exists()
def serv_button_group(appliance, request):

    with appliance.context.use(ViaUI):
        collection = appliance.collections.button_groups
        button_gp = collection.create(
            text="group_{}".format(fauxfactory.gen_numeric_string(3)),
            hover="hover_{}".format(fauxfactory.gen_alphanumeric(3)),
            display=TEXT_DISPLAY[request.param]["group_display"],
            type=getattr(collection, "SERVICE"),
        )

        button = button_gp.buttons.create(
            text="btn_{}".format(fauxfactory.gen_numeric_string(3)),
            hover="hover_{}".format(fauxfactory.gen_alphanumeric(3)),
            display=TEXT_DISPLAY[request.param]["btn_display"],
            display_for="Single and list",
            system="Request",
            request="InspectMe",
        )
        yield button, button_gp
        button_gp.delete_if_exists()
        button.delete_if_exists()
Beispiel #29
0
    def test_gen_numeric_string_2(self):
        """
        @Test: Create numeric string of fixed length
        @Feature: String Generator
        @Assert: Numeric string is created
        """

        for length in range(2, 12, 2):
            result = gen_numeric_string(length)
            self.assertEqual(
                len(result),
                length,
                "Generate string does not have the expected length")
Beispiel #30
0
def test_custom_button_unassigned_behavior_catalog_level(
        appliance, generic_service):
    """ Test unassigned custom button behavior catalog level

    Note: At catalog level unassigned button (not part of any group) should displayed
    for both OPS UI and SSUI.

    Polarion:
        assignee: ndhandre
        initialEstimate: 1/6h
        caseimportance: medium
        caseposneg: positive
        testtype: functional
        startsin: 5.9
        casecomponent: CustomButton
        testSteps:
            1. Create custom button directly on catalog item.
            2. Check service details page for both OPS UI and SSUI; button should display.
    Bugzilla:
        1653195
    """
    service, catalog_item = generic_service

    btn_data = {
        "text": "button_{}".format(gen_numeric_string(3)),
        "hover": "hover_{}".format(gen_numeric_string(3)),
        "image": "fa-user",
    }

    btn = catalog_item.add_button(**btn_data)
    assert catalog_item.button_exists(btn)

    for context in [ViaUI, ViaSSUI]:
        navigate_to = ssui_nav if context is ViaSSUI else ui_nav
        with appliance.context.use(context):
            view = navigate_to(service, "Details")
            button = Button(view, btn)
            assert button.is_displayed
def test_custom_button_unassigned_behavior_catalog_level(appliance, generic_service):
    """ Test unassigned custom button behavior catalog level

    Note: At catalog level unassigned button (not part of any group) should displayed
    for both OPS UI and SSUI.

    Polarion:
        assignee: ndhandre
        initialEstimate: 1/6h
        caseimportance: medium
        caseposneg: positive
        testtype: functional
        startsin: 5.9
        casecomponent: CustomButton
        testSteps:
            1. Create custom button directly on catalog item.
            2. Check service details page for both OPS UI and SSUI; button should display.
    Bugzilla:
        1653195
    """
    service, catalog_item = generic_service

    btn_data = {
        "text": "button_{}".format(gen_numeric_string(3)),
        "hover": "hover_{}".format(gen_numeric_string(3)),
        "image": "fa-user",
    }

    btn = catalog_item.add_button(**btn_data)
    assert catalog_item.button_exists(btn)

    for context in [ViaUI, ViaSSUI]:
        navigate_to = ssui_nav if context is ViaSSUI else ui_nav
        with appliance.context.use(context):
            view = navigate_to(service, "Details")
            button = Button(view, btn)
            assert button.is_displayed
Beispiel #32
0
def generic_definition(appliance):
    """Generic object definition or class"""

    with appliance.context.use(ViaREST):
        definition = appliance.collections.generic_object_definitions.create(
            name=fauxfactory.gen_numeric_string(17,
                                                start="gen_rest_class",
                                                separator="-"),
            description="Generic Object Definition",
            attributes={"addr01": "string"},
            associations={"services": "Service"},
            methods=["add_vm", "remove_vm"],
        )
        yield definition
        definition.delete_if_exists()
Beispiel #33
0
def mocked_image_data():
    out = [200, {'items': []}]
    for i in range(fauxfactory.gen_integer(2, 20)):
        dockerImageReference, imageID = gen_docker_image_reference()
        out[1]['items'].append({
            'metadata': {
                'name': 'mockedimage{}'.format(i),
                'namespace': choice(
                    ('default', 'openshift-infra', 'kube-system'))
            }
        })
        out[1]['items'][-1]['dockerImageReference'] = \
            dockerImageReference.format(fauxfactory.gen_numeric_string())
        out[1]['items'][-1]['status'] = {
            'dockerImageRepository':
            dockerImageReference,
            'containerStatuses': [{
                'image':
                out[1]['items'][-1]['dockerImageReference'],
                'imageID':
                imageID.format(fauxfactory.gen_numeric_string(64))
            } for _ in range(fauxfactory.gen_integer(2, 20))]
        }
    return out
Beispiel #34
0
def generic_object(generic_definition, gen_rest_service, appliance):
    """Generic object associated with service"""

    myservice = MyService(appliance, name=gen_rest_service.name)

    with appliance.context.use(ViaREST):
        instance = appliance.collections.generic_objects.create(
            name=fauxfactory.gen_numeric_string(20,
                                                start="gen_rest_instance",
                                                separator="-"),
            definition=generic_definition,
            attributes={"addr01": "Test Address"},
            associations={"services": [gen_rest_service]},
        )
        instance.my_service = myservice
        yield instance
        instance.delete_if_exists()
Beispiel #35
0
 def test_properties(self, gen_node):
     # Just test that there are no errors when we try to get properties
     if MOCKED:
         gen_node.provider.api.get.return_value = [
             200, {
                 'status': {
                     'capacity': {
                         'cpu':
                         fauxfactory.gen_integer(1, 8),
                         'memory':
                         '{}kb'.format(fauxfactory.gen_numeric_string())
                     },
                     'conditions': [{
                         'status': 'Running'
                     }]
                 }
             }
         ]
     gen_node.cpu, gen_node.ready, gen_node.memory
Beispiel #36
0
def test_service_rbac_orchestration(appliance, role_user_group):
    """ Test service rbac with orchestration

    Polarion:
        assignee: apagac
        initialEstimate: 1/4h
        casecomponent: Services
    """
    role, user = role_user_group
    product_features = [(['Everything'], True), (['Everything'], False)]
    product_features.extend([(['Everything', 'Services', 'Catalogs Explorer', k], True)
                             for k in ['Orchestration Templates']])
    role.update({'product_features': product_features})
    with user:
        appliance.server.login(user)
        collection = appliance.collections.orchestration_templates
        template = collection.create(
            template_name=fauxfactory.gen_alphanumeric(),
            template_type='Amazon CloudFormation',
            template_group='CloudFormation Templates',
            description='template description',
            content=fauxfactory.gen_numeric_string())
        assert template.exists
        template.delete()
 def num_string_generator(size=10):
     return fauxfactory.gen_numeric_string(size)
Beispiel #38
0
def test_gen_url_11():
    """Create a random URL with numeric TLDS."""
    for _ in range(10):
        with pytest.raises(ValueError):
            tlds = gen_numeric_string(length=3)
            gen_url(tlds=tlds)
Beispiel #39
0
def _filter_crud(param, appliance):
    """
    Polarion:
        assignee: anikifor
        casecomponent: WebUI
        caseimportance: high
        initialEstimate: 1/10h
    """
    filter_name = fauxfactory.gen_string('alphanumeric', 10)
    filter_value = fauxfactory.gen_string('alphanumeric', 10)
    filter_value_updated = fauxfactory.gen_string('alphanumeric', 10)
    view = _navigation(param, appliance)
    # create
    if ':' not in param.filter:  # to test "Count of" field, values don't contain ':'
        filter_value = fauxfactory.gen_numeric_string(3)
        filter_value_updated = fauxfactory.gen_numeric_string(3)
        view.search.save_filter(
            "fill_count({}, =, {})".format(param.filter, filter_value),
            filter_name)
    else:
        view.search.save_filter(
            "fill_field({}, =, {})".format(param.filter, filter_value),
            filter_name)
    view.search.close_advanced_search()
    view.flash.assert_no_error()
    # read
    if param.my_filters:
        if isinstance(param.my_filters, tuple):
            filters = operator.attrgetter(param.my_filters[0])(view)
            _filter_displayed(
                filters,
                filters.tree.has_path(param.my_filters[1], "My Filters",
                                      filter_name))
        else:
            filters = operator.attrgetter(param.my_filters)(view)
            _filter_displayed(filters,
                              filters.tree.has_path("My Filters", filter_name))
    else:
        filters = view.my_filters
        _filter_displayed(filters, filters.navigation.has_item(filter_name))
    # update
    _select_filter(filters, filter_name, param)
    view.search.open_advanced_search()
    view.search.advanced_search_form.search_exp_editor.select_first_expression(
    )
    if ':' not in param.filter:  # to test "Count of" field
        view.search.advanced_search_form.search_exp_editor.fill_count(
            count=param.filter, key='=', value=filter_value_updated)
    else:
        view.search.advanced_search_form.search_exp_editor.fill_field(
            field=param.filter, key='=', value=filter_value_updated)
    # save expression
    view.search.advanced_search_form.save_filter_button.click()
    # save filter
    view.search.advanced_search_form.save_filter_button.click()
    view.search.close_advanced_search()
    _select_filter(filters, filter_name, param)
    # read after update
    view.search.open_advanced_search()
    exp_text = view.search.advanced_search_form.search_exp_editor.expression_text
    assert filter_value_updated in exp_text, "Filter wasn't changed!"
    # delete
    view.search.delete_filter()
    view.search.close_advanced_search()
    if param.my_filters:
        if filters.is_displayed:
            if isinstance(param.my_filters, tuple):
                assert not filters.tree.has_path(
                    param.my_filters[1], "My Filters",
                    filter_name), "Filter wasn't deleted!"
            else:
                assert not filters.tree.has_path(
                    "My Filters", filter_name), "Filter wasn't deleted!"
    else:
        if view.my_filters.is_displayed:
            assert not view.my_filters.navigation.has_item(
                filter_name), "Filter wasn't deleted!"
def test_custom_button_on_generic_class_crud(appliance, button_group,
                                             is_undefined):
    """Test custom button crud operation on generic class definition

    Bugzilla:
        1534539
        1744478
        1753289

    Polarion:
        assignee: tpapaioa
        initialEstimate: 1/4h
        caseimportance: critical
        startsin: 5.10
        casecomponent: CustomButton
        testSteps:
            1. Create custom button on generic class (with group and undefined)
            2. Update custom button by editing
            3. Delete custom button
    """
    parent = button_group.parent.parent if is_undefined else button_group

    with appliance.context.use(ViaUI):
        # create button
        button = parent.collections.generic_object_buttons.create(
            name=fauxfactory.gen_numeric_string(start="btn", separator="-"),
            description=fauxfactory.gen_numeric_string(start="disc",
                                                       separator="-"),
            image="fa-home",
            request="InspectMe",
        )
        view = appliance.browser.create_view(
            GenericObjectDefinitionDetailsView)

        if is_undefined:
            msg = f'Custom Button "{button.name}" has been successfully added.'
        else:
            msg = (
                f'Custom Button "{button.name}" has been successfully added '
                f"under the selected button group.")

        view.flash.assert_success_message(msg)
        assert button.exists

        # update button
        with update(button):
            button.name = fauxfactory.gen_numeric_string(start="btn",
                                                         separator="-")
            button.description = fauxfactory.gen_alphanumeric(start="disc",
                                                              separator="-")
        view.flash.assert_success_message(
            f'Custom Button "{button.name}" has been successfully saved.')
        assert button.exists

        # delete button
        button.delete()
        # TODO(ndhandre): For now, we can not guess exact flash message.
        #  Change flash as per BZ-1744478.
        if not (BZ(1744478).blocks or BZ(1773666).blocks):
            view.flash.assert_success_message(
                f'CustomButton: "{button.name}" was successfully deleted')
        else:
            view.flash.assert_success_message(
                'Button:"undefined" was successfully deleted')
        assert not button.exists
    image = 'logo.png'
    fs = FTPClientWrapper(cfme_data.ftpserver.entities.others)
    file_path = fs.download(image)

    view = navigate_to(catalog_bundle, 'Details')
    view.entities.upload_image.fill(file_path)
    view.entities.upload_button.click()
    view.flash.assert_message(
        f'Custom Image file "{image}" successfully uploaded')

    view.entities.remove.click()
    view.flash.assert_message('Custom Image successfully removed')


CURRENCY_VALUES = {
    "valid": fauxfactory.gen_numeric_string(4),
    "empty": "",
    "invalid": fauxfactory.gen_alpha(4)
}


@pytest.mark.meta(automates=[1602072])
@pytest.mark.parametrize("value",
                         CURRENCY_VALUES.values(),
                         ids=CURRENCY_VALUES.keys())
def test_catalog_item_price_currency(appliance, catalog, value):
    """
    Bugzilla:
        1602072
    Polarion:
        assignee: nansari
Beispiel #42
0
import unittest

from nose2.tools import params
from pyparsing import ParseException
import fauxfactory


symbol_tests = [
    fauxfactory.gen_alpha(),
    "_{0}".format(fauxfactory.gen_alpha()),
    "{0}.{1}".format(fauxfactory.gen_alpha(), fauxfactory.gen_alpha()),
    "_{0}.{1}".format(fauxfactory.gen_alpha(), fauxfactory.gen_alpha()),
    ("'{0}'".format(fauxfactory.gen_alpha()), ParseException),
    ('"{0}"'.format(fauxfactory.gen_alpha()), ParseException),
    (fauxfactory.gen_numeric_string(), ParseException),
]

value_tests = [
    "'{0}'".format(fauxfactory.gen_alpha()),
    '"{0}"'.format(fauxfactory.gen_alpha()),
    fauxfactory.gen_numeric_string(),
    fauxfactory.gen_date().isoformat(),
    fauxfactory.gen_time().isoformat(),
    fauxfactory.gen_datetime().isoformat(),
    (fauxfactory.gen_alpha(), ParseException),
    ("_{0}".format(fauxfactory.gen_alpha()), ParseException),
    ("{0}.{1}".format(fauxfactory.gen_alpha(), fauxfactory.gen_alpha()), ParseException),
    ("_{0}.{1}".format(fauxfactory.gen_alpha(), fauxfactory.gen_alpha()), ParseException),
]

regex_tests = [