示例#1
0
def test_unsuccessful_drop_table(rethink_connect):
    result = drop_table(database, empty_table, rethink_connect)
    assert result is not None
    assert len(result) == 1
    assert result["tables_dropped"] == 0
示例#2
0
def configure_database():
    connection = connect(ReDB_HOST,
                         ReDB_PORT,
                         user=ReDB_USER,
                         password=ReDB_PASS)
    # Initial Set Up
    drop_table(database, table, connection)
    drop_table(database, empty_table, connection)
    create_table(database, table, connection)
    create_table(database, empty_table, connection)

    data = [
        {
            "name":
            "The Dark Knight Rises",
            "year":
            2012,
            "runtime":
            163,
            "categories": ["adventure", "thriller"],
            "release-date":
            "2012-07-20",
            "director":
            "Christopher Nolan",
            "writer": [
                "Jonathan Nolan",
                "David S. Goyer",
                "Christopher Nolan",
                "Bob Kane",
            ],
            "actors": ["Christian Bale", "Tom Hardy", "Anne Hathway"],
            "storyline":
            "Eight years after the Joker's reign of anarchy,"
            " the Dark Knight, with the help of the enigmatic"
            " Catwoman, is forced from his imposed exile to save"
            " Gotham City, now on the edge of total annihilation,"
            " from the brutal guerrilla terrorist Bane.",
        },
        {
            "name":
            "Avengers: Infinity War",
            "year":
            2018,
            "runtime":
            149,
            "categories": ["Action", "Adventure", "Fantasy"],
            "release-date":
            "2018-04-27",
            "director": ["Anthony Russo", "Joe Russo"],
            "writer": ["Christopher Markus", "Stephen McFeely"],
            "actors": [
                "Robert Downey Jr.",
                "Chris Hemsworth",
                "Mark Ruffalo",
                "Chris Evans",
                "Scarlett Johansson",
                "Benedict Cumberbatch",
            ],
            "storyline":
            "The Avengers and their allies must be willing to"
            " sacrifice all in an attempt to defeat the"
            " powerful Thanos before his blitz of devastation"
            " and ruin puts an end to the universe.",
        },
    ]

    result = insert(database, table, data, connection)

    global unique_id
    unique_id = result.get("generated_keys")[0]
示例#3
0
def test_successful_drop_table(rethink_connect):
    result = drop_table(database, empty_table, rethink_connect)
    assert result is not None
    assert len(result) is 1
    assert result['tables_dropped'] is 1