Beispiel #1
0
def test_database_nodes():
    """Test all nodes operations.

    """
    database = TaskDatabase()
    database.create_node('root', 'node1')
    database.create_node('root/node1', 'node2')
    database.rename_node('root', 'node1', 'n_node1')
    database.delete_node('root/n_node1', 'node2')
    with raises(KeyError):
        database.delete_node('root/n_node1', 'node2')
Beispiel #2
0
def test_database_nodes():
    """Test all nodes operations.

    """
    database = TaskDatabase()
    database.create_node('root', 'node1')
    database.create_node('root/node1', 'node2')
    database.rename_node('root', 'node1', 'n_node1')
    database.delete_node('root/n_node1', 'node2')
    with raises(KeyError):
        database.delete_node('root/n_node1', 'node2')
Beispiel #3
0
def test_forbidden_operations():
    """Check that all forbidden operations does raise a RuntimeError.

    """
    database = TaskDatabase()
    database.prepare_to_run()
    with raises(RuntimeError):
        database.rename_values('root', [], [])
    with raises(RuntimeError):
        database.delete_value('root', '')
    with raises(RuntimeError):
        database.create_node('root', '')
    with raises(RuntimeError):
        database.rename_node('root', '', '')
    with raises(RuntimeError):
        database.delete_node('root', '')
Beispiel #4
0
def test_forbidden_operations():
    """Check that all forbidden operations does raise a RuntimeError.

    """
    database = TaskDatabase()
    database.prepare_to_run()
    with raises(RuntimeError):
        database.rename_values('root', [], [])
    with raises(RuntimeError):
        database.delete_value('root', '')
    with raises(RuntimeError):
        database.create_node('root', '')
    with raises(RuntimeError):
        database.rename_node('root', '', '')
    with raises(RuntimeError):
        database.delete_node('root', '')