Пример #1
0
    def check_volume_status(self,
                            volume,
                            statuses,
                            transit_statuses=(),
                            timeout=0):
        """Check step volume status.

        Args:
            volume (object|str): cinder volume to check status or its id
            statuses (list): list of statuses to check
            transit_statuses (tuple): possible volume transitional statuses
            timeout (int): seconds to wait a result of check

        Raises:
            TimeoutExpired|AssertionError: if check failed after timeout
        """
        transit_matchers = [
            equal_to_ignoring_case(status) for status in transit_statuses
        ]

        if not hasattr(volume, 'id'):
            volume = self.get_volume_by_id(volume)

        def _check_volume_status():
            volume.get()
            return waiter.expect_that(volume.status,
                                      is_not(any_of(*transit_matchers)))

        waiter.wait(_check_volume_status, timeout_seconds=timeout)
        matchers = [equal_to_ignoring_case(status) for status in statuses]
        assert_that(volume.status, any_of(*matchers))
Пример #2
0
    def check_backup_status(self,
                            backup,
                            status,
                            transit_statuses=(config.STATUS_CREATING,),
                            timeout=0):
        """Check step volume backup status.

        Args:
            backup (object or str): volume backup object or its id
                to check status
            status (str): backup status name to check
            transit_statuses (tuple): possible backup transitional statuses
            timeout (int): seconds to wait a result of check

        Raises:
            TimeoutExpired: if check failed after timeout
        """
        if not hasattr(backup, 'id'):
            backup = self.get_backup_by_id(backup)

        transit_matchers = [
            equal_to_ignoring_case(st) for st in transit_statuses
        ]

        def _check_backup_status():
            backup.get()
            return waiter.expect_that(backup.status,
                                      is_not(any_of(*transit_matchers)))

        waiter.wait(_check_backup_status, timeout_seconds=timeout)
        err_msg = self._error_message(backup)
        assert_that(backup.status, equal_to_ignoring_case(status), err_msg)
    def test_service_health_checks(self, __service):
        """
        Test if given service has all health-checks passed
        """
        for check in __service.health_checks['checks']:
            with allure.step(
                    'Testing health-check "%s" for "%s" fixture on "%s" node' %
                (check.id, __service['name'], check.node)):

                log.info('Health check "%s", status "%s" : %s' %
                         (check.id, check.status, check.output))
                assert_that(check.status, equal_to_ignoring_case('passing'),
                            "Service check should be passed")
Пример #4
0
    def wait_for_status(self, status, timeout=config.EVENT_TIMEOUT):
        """Wait status value after transit statuses."""
        self.wait_for_presence()
        with self.cell('status') as cell:

            def _wait_cell_status():
                matchers = [equal_to_ignoring_case(status)
                            for status in self.transit_statuses]
                return waiter.expect_that(cell.value, is_not(
                    any_of(*matchers)))

            waiter.wait(_wait_cell_status, timeout_seconds=timeout)
            assert_that(cell.value, equal_to_ignoring_case(status))
Пример #5
0
    def test_logged_customer_header_and_menu(self, config, setup, teardown):
        user = GkrUserSteps(config)
        main_page = MainPage(config)
        c = CUSTOMER
        user.login(c.customers_data.mobile_phone, c.password)
        user.should_see_element(main_page.top_menu.PROFILE)
        user.should_see_element_matched_to(
            main_page.top_menu.PROFILE,
            equal_to_ignoring_case(c.customers_data.name + ' ' +
                                   c.customers_data.patronymic))

        customer_menu_items = menu_items
        customer_menu_items.remove(MainMenu.HISTORY.item)
        user.should_see_list_values(main_page.main_menu.MENU, menu_items)
Пример #6
0
    def should_see_attribute_value(self, element, attribute, value):
        if 'Input' in str(element.__class__):
            element_ = element.input
        elif 'Textarea' in str(element.__class__):
            element_ = element.textarea
        else:
            element_ = element.element

        element_attribute = element_.get_attribute(attribute)
        assert_that(element_attribute, not_none(),
                    u'Атрибут отсутствует у элемента')
        assert_that(
            element_attribute, equal_to_ignoring_case(str(value)),
            u'Значение атрибута ' + attribute + ' не соответствует ожидаемому')
Пример #7
0
def test_get_authorize_url():
    CONFIG = {
        'client_id': '<client_id>',
        'client_secret': '<client_secret>',
        'redirect_uri': 'http://localhost:8515/oauth_callback'
    }
    unauthenticated_api = client.InstagramAPI(**CONFIG)
    url = unauthenticated_api.get_authorize_url(scope=[
        'basic', 'public_content', 'follower_list', 'relationships', 'likes'
    ])

    assert_that(
        url,
        equal_to_ignoring_case(
            f"https://api.instagram.com/oauth/authorize/?client_id={CONFIG['client_id']}&redirect_uri={CONFIG['redirect_uri']}&response_type=code&scope=basic+public_content+follower_list+relationships+likes"
        ))
Пример #8
0
    def check_snapshot_status(self, snapshot, statuses, timeout=0):
        """Step to check snapshots status.

        Args:
            snapshot (obj): cinder volume snapshot objects or id to check
                status
            statuses (list): list of statuses names to check
            timeout (int): seconds to wait a result of check

        Raises:
            TimeoutExpired: if check failed after timeout
        """
        matchers = [equal_to_ignoring_case(status) for status in statuses]

        def _check_snapshot_status():

            if hasattr(snapshot, 'id'):
                snapshot_id = snapshot.id
            else:
                snapshot_id = snapshot
            status = self.get_snapshot_by_id(snapshot_id).status
            return waiter.expect_that(status, any_of(*matchers))

        waiter.wait(_check_snapshot_status, timeout_seconds=timeout)
Пример #9
0
 def _wait_cell_status():
     matchers = [equal_to_ignoring_case(status)
                 for status in self.transit_statuses]
     return waiter.expect_that(cell.value, is_not(
         any_of(*matchers)))
 def assert_that_validation_message_is_presented(self, input_name, message):
     assert_that(
         self.get_text(
             self._CREATE_PROJECT_ERROR_MESSAGE_TEMPLATE.format(
                 input_name=input_name)), equal_to_ignoring_case(message))
Пример #11
0
 def test_title_exists(self):
     assert_that(self.browser.title, equal_to_ignoring_case('quizzology'))
Пример #12
0
 def assert_that_error_message_is_presented(self, message):
     assert_that(self.get_text(self._LOGIN_ERROR_MESSAGE),
                 equal_to_ignoring_case(message))