예제 #1
0
def test_switch_to_default_content():
    mock_driver = MagicMock(name="driver")
    interact = Interactor(mock_driver, None, None, None, None)

    interact.switch_to_default_content()

    check_mocked_functions_called(mock_driver.switch_to.default_content)
def test_init_unique_log_file_logger(mock_logging, mock_path_exists):
    init_unique_log_file_logger()
    check_mocked_functions_called(mock_path_exists)
    assert_that(mock_logging.method_calls[0][0], contains_string("basicConfig"),
                "logger_handler isn't using basicConfig as expected")
    assert_that(mock_logging.method_calls[0][2]['level'], equal_to(20),
                "logger_handler default log level is not as expected")
예제 #3
0
def test_table_is_not_empty(mock_get_table_row_count):
    mock_finder = MagicMock()
    mock_finder.element.return_value = [
        "element_1", "element_2", "element_3", "element_4", "element_5"
    ]
    interrogate = Interrogator(None, mock_finder, MagicMock(name="logger"))

    result = interrogate.table_is_not_empty(default_page_element)

    check_mocked_functions_called(mock_get_table_row_count)
    assert_that(result, equal_to(True), "Empty table should have been handled")
def test_init_unique_log_file_logger_creates_folder(mock_makedirs, mock_logging, mock_path_exists):
    init_unique_log_file_logger("test/logs")
    check_mocked_functions_called(mock_makedirs, mock_path_exists)
    mock_makedirs.assert_called_with("test/logs")