Beispiel #1
0
 def __init__(self,
              err=None,
              message='Exception without message',
              log=None):
     """Raise an exception from any part of qacode package"""
     super(CoreException, self).__init__(err, message)
     self.message = "FAILED {}: message={}".format(
         type(self),
         message)
     if log is None:
         self.log = LoggerManager().logger
     else:
         self.log = log
     if err is not None and isinstance(err, NoSuchElementException):
         self.log.warning(err.args)
     self.log.error(self.message)
Beispiel #2
0
 def setUpClass(cls):
     """Just starting testcase instance dependencies"""
     global LOGGER_MANAGER
     LOGGER_MANAGER = LoggerManager()
     print("TestInfoBase.setup@classmethod: code mark")
Beispiel #3
0
# -*- coding: utf-8 -*-
"""Testsuite for package testing"""

from unittest import TestCase
from unittest import skipIf
from qacode.core.bots.bot_base import BotBase
from qacode.core.loggers.logger_manager import LoggerManager
from qacode.core.testing.test_info_bot import TestInfoBot
from qacode.core.utils import settings

SETTINGS = settings()
SKIP_REMOTES = SETTINGS['tests']['skip']['drivers_remote']
SKIP_REMOTES_MSG = 'drivers_remote DISABLED by config file'
LOGGER_MANAGER = LoggerManager(log_level=SETTINGS['bot']['log_level'])


class TestInfoBotMultiple(TestInfoBot):
    """Tests for class TestInfoBot"""
    def __init__(self, method_name="suite_TestTestInfoBot"):
        """Just call to parent constructor class, see TestTestInfoBot

        Keyword Arguments:
            method_name {str} -- name for test info bot testsuite
                (default: {"suite_TestTestInfoBot"})
        """
        super(TestInfoBotMultiple,
              self).__init__(method_name,
                             logger_manager=LOGGER_MANAGER,
                             test_config=SETTINGS)

    @skipIf(SKIP_REMOTES, SKIP_REMOTES_MSG)
Beispiel #4
0
# -*- coding: utf-8 -*-
# pylint: disable=deprecated-method
# pylint: disable=invalid-name
"""Test Suite module for configs"""

import os
from unittest import skipIf
from qacode.core.loggers.logger_manager import LoggerManager
from qacode.core.testing.test_info_base import TestInfoBase
from qacode.core.utils import path_format

LOGGER_MANAGER = LoggerManager()
MSG_OBSOLETE = "Test obsolete, need new tests for key tests.functionals.pages"


class TestConfig(TestInfoBase):
    """Testcases for class TestInfoBase"""

    # Error Messages
    ERR_KEY_NOT_FOUND = "Required key '{}', can't be None"
    ERR_KEY_INVALID_VALUE = "Required key '{}', just can be in '{}'"
    ERR_KEY_PATH_NOT_FOUND = "Required key '{}', not found for path '{}'"
    ERR_KEY_EMPTY = "Required key '{}', can't be empty, value='{}'"
    ERR_KEY_REGEX = "Optional key '{}', not provided or not matching regex: {}"
    # Test constants
    PATH_SETTINGS = "qacode/configs/settings.json"
    REGEX_URL = r"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+"  # noqa: E501

    def __init__(self, method_name="TestConfig"):
        """Constructor
Beispiel #5
0
 def test_006_logger_loglevelbyconfig(self):
     """Test: test_006_logger_loglevelbyconfig"""
     self.logger_manager_test = LoggerManager(
         log_level=SETTINGS['bot']['log_level'])
     self.log = self.logger_manager_test.logger
     self.log.warning("Unitary test, checking level type by JSON key")