Skip to content

Logging

TestLoggingPage

Bases: UccTester

Source code in tests/ui/test_configuration_page_logging_tab.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
class TestLoggingPage(UccTester):
    @pytest.mark.logging
    def test_logging_default_log_level(
        self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
    ):
        logging = Logging(
            C.ADDON_NAME,
            ucc_smartx_selenium_helper=ucc_smartx_selenium_helper,
            ucc_smartx_rest_helper=ucc_smartx_rest_helper,
        )
        self.assert_util(logging.backend_conf.get_parameter("disabled"), False)
        self.assert_util(logging.log_level.get_value, _DEFAULT_LOG_LEVEL)

    @pytest.mark.logging
    def test_logging_list_log_levels(
        self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
    ):
        logging = Logging(
            C.ADDON_NAME,
            ucc_smartx_selenium_helper=ucc_smartx_selenium_helper,
            ucc_smartx_rest_helper=ucc_smartx_rest_helper,
        )
        expected_list = ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
        self.assert_util(list(logging.log_level.list_of_values()), expected_list)

    @pytest.mark.logging
    def test_logging_select_random_log_level(
        self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper, _reset_configuration
    ):
        logging = Logging(
            C.ADDON_NAME,
            ucc_smartx_selenium_helper=ucc_smartx_selenium_helper,
            ucc_smartx_rest_helper=ucc_smartx_rest_helper,
        )
        selection_log = set(logging.log_level.list_of_values())
        for log_level in selection_log:
            logging.log_level.select(log_level)
            logging.save()
            self.assert_util(logging.log_level.get_value, log_level)

    @pytest.mark.logging
    def test_logging_selected_log_level_frontend_backend(
        self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper, _reset_configuration
    ):
        selection_log = "DEBUG"
        logging = Logging(
            C.ADDON_NAME,
            ucc_smartx_selenium_helper=ucc_smartx_selenium_helper,
            ucc_smartx_rest_helper=ucc_smartx_rest_helper,
        )
        logging.log_level.select(selection_log)
        logging.save()
        self.assert_util(logging.log_level.get_value().lower(), selection_log.lower())
        log_level = logging.backend_conf.get_parameter("loglevel")
        self.assert_util(log_level, selection_log)

    @pytest.mark.logging
    def test_logging_label_log_level(
        self,
        ucc_smartx_selenium_helper,
        ucc_smartx_rest_helper,
    ):
        """
        Verifies the label of log level
        """
        logging = Logging(  # noqa: F811
            C.ADDON_NAME,
            ucc_smartx_selenium_helper=ucc_smartx_selenium_helper,
            ucc_smartx_rest_helper=ucc_smartx_rest_helper,
        )
        self.assert_util(logging.log_level.get_input_label, "Log level")

test_logging_default_log_level(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)

Source code in tests/ui/test_configuration_page_logging_tab.py
18
19
20
21
22
23
24
25
26
27
28
@pytest.mark.logging
def test_logging_default_log_level(
    self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
):
    logging = Logging(
        C.ADDON_NAME,
        ucc_smartx_selenium_helper=ucc_smartx_selenium_helper,
        ucc_smartx_rest_helper=ucc_smartx_rest_helper,
    )
    self.assert_util(logging.backend_conf.get_parameter("disabled"), False)
    self.assert_util(logging.log_level.get_value, _DEFAULT_LOG_LEVEL)

test_logging_label_log_level(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)

Verifies the label of log level

Source code in tests/ui/test_configuration_page_logging_tab.py
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
@pytest.mark.logging
def test_logging_label_log_level(
    self,
    ucc_smartx_selenium_helper,
    ucc_smartx_rest_helper,
):
    """
    Verifies the label of log level
    """
    logging = Logging(  # noqa: F811
        C.ADDON_NAME,
        ucc_smartx_selenium_helper=ucc_smartx_selenium_helper,
        ucc_smartx_rest_helper=ucc_smartx_rest_helper,
    )
    self.assert_util(logging.log_level.get_input_label, "Log level")

test_logging_list_log_levels(ucc_smartx_selenium_helper, ucc_smartx_rest_helper)

Source code in tests/ui/test_configuration_page_logging_tab.py
30
31
32
33
34
35
36
37
38
39
40
@pytest.mark.logging
def test_logging_list_log_levels(
    self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper
):
    logging = Logging(
        C.ADDON_NAME,
        ucc_smartx_selenium_helper=ucc_smartx_selenium_helper,
        ucc_smartx_rest_helper=ucc_smartx_rest_helper,
    )
    expected_list = ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
    self.assert_util(list(logging.log_level.list_of_values()), expected_list)

test_logging_select_random_log_level(ucc_smartx_selenium_helper, ucc_smartx_rest_helper, _reset_configuration)

Source code in tests/ui/test_configuration_page_logging_tab.py
42
43
44
45
46
47
48
49
50
51
52
53
54
55
@pytest.mark.logging
def test_logging_select_random_log_level(
    self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper, _reset_configuration
):
    logging = Logging(
        C.ADDON_NAME,
        ucc_smartx_selenium_helper=ucc_smartx_selenium_helper,
        ucc_smartx_rest_helper=ucc_smartx_rest_helper,
    )
    selection_log = set(logging.log_level.list_of_values())
    for log_level in selection_log:
        logging.log_level.select(log_level)
        logging.save()
        self.assert_util(logging.log_level.get_value, log_level)

test_logging_selected_log_level_frontend_backend(ucc_smartx_selenium_helper, ucc_smartx_rest_helper, _reset_configuration)

Source code in tests/ui/test_configuration_page_logging_tab.py
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
@pytest.mark.logging
def test_logging_selected_log_level_frontend_backend(
    self, ucc_smartx_selenium_helper, ucc_smartx_rest_helper, _reset_configuration
):
    selection_log = "DEBUG"
    logging = Logging(
        C.ADDON_NAME,
        ucc_smartx_selenium_helper=ucc_smartx_selenium_helper,
        ucc_smartx_rest_helper=ucc_smartx_rest_helper,
    )
    logging.log_level.select(selection_log)
    logging.save()
    self.assert_util(logging.log_level.get_value().lower(), selection_log.lower())
    log_level = logging.backend_conf.get_parameter("loglevel")
    self.assert_util(log_level, selection_log)