Exemplo n.º 1
0
def test_update_table(graph_cases):
    """
    :type graph_cases: qmxgraph.tests.conftest.GraphCaseFactory
    """
    graph = graph_cases('1t')

    table_id = graph.get_id(graph.get_tables()[0])
    contents = {  # graphs.utils.TableDescription
        'contents': [
            # graphs.utils.TableRowDescription's
            {
                'contents': ['a', 1]
            },
            {
                'contents': ['b', 2]
            },
        ]
    }
    title = 'updated'
    graph.selenium.execute_script(
        js.prepare_js_call('api.updateTable', table_id, contents, title))

    table = graph.get_tables()[0]
    assert graph.get_table_title(table) == 'updated'
    assert graph.get_table_contents(table) == ['a', '1', 'b', '2']
Exemplo n.º 2
0
def test_update_table_error_not_table(graph_cases, selenium_extras):
    """
    :type graph_cases: qmxgraph.tests.conftest.GraphCaseFactory
    :type selenium_extras: qmxgraph.tests.conftest.SeleniumExtras
    """
    graph = graph_cases('2v_1e_1d_1t')

    table_id = graph.get_id(graph.get_edge(*graph.get_vertices()))
    contents = []
    title = 'will not matter'

    with pytest.raises(WebDriverException) as e:
        graph.selenium.execute_script(
            js.prepare_js_call('api.updateTable', table_id, contents, title))

    assert selenium_extras.get_exception_message(e) == "Cell is not a table"
Exemplo n.º 3
0
def test_update_table_error_not_found(graph_cases, selenium_extras):
    """
    :type graph_cases: qmxgraph.tests.conftest.GraphCaseFactory
    :type selenium_extras: qmxgraph.tests.conftest.SeleniumExtras
    """
    graph = graph_cases('1t')

    table_id = "999"
    contents = []
    title = 'will not matter'

    with pytest.raises(WebDriverException) as e:
        graph.selenium.execute_script(
            js.prepare_js_call('api.updateTable', table_id, contents, title))

    assert selenium_extras.get_exception_message(e) == \
        "Unable to find cell with id {}".format(table_id)
Exemplo n.º 4
0
def test_update_table(graph_cases):
    """
    :type graph_cases: qmxgraph.tests.conftest.GraphCaseFactory
    """
    graph = graph_cases('1t')

    table_id = graph.get_id(graph.get_table())
    contents = [
        ['a', 1],
        ['b', 2],
    ]
    title = 'updated'
    graph.selenium.execute_script(
        js.prepare_js_call('api.updateTable', table_id, contents, title))

    table = graph.get_table()
    assert graph.get_table_title(table) == 'updated'
    assert graph.get_table_contents(table) == ['a', '1', 'b', '2']