def test_rollback_on_connection_closing(shared_instance, dbapi_database):
    "\n    When closing a connection all the pending transactions\n    must be rollbacked. Testing if it's working this way.\n    "
    want_row = (1, 'first-name', 'last-name', 'example@example.com')
    conn = Connection(shared_instance, dbapi_database)
    cursor = conn.cursor()
    cursor.execute("\nINSERT INTO contacts (contact_id, first_name, last_name, email)\nVALUES (1, 'first-name', 'last-name', 'example@example.com')\n    ")
    conn.commit()
    cursor.execute("\nUPDATE contacts\nSET first_name = 'updated-first-name'\nWHERE first_name = 'first-name'\n")
    conn.close()
    conn = Connection(shared_instance, dbapi_database)
    cursor = conn.cursor()
    cursor.execute('SELECT * FROM contacts')
    got_rows = cursor.fetchall()
    conn.commit()
    assert (got_rows == [want_row])
    cursor.close()
    conn.close()
When closing a connection all the pending transactions
must be rollbacked. Testing if it's working this way.
def test_rollback_on_connection_closing(shared_instance, dbapi_database):
    "\n    When closing a connection all the pending transactions\n    must be rollbacked. Testing if it's working this way.\n    "
    want_row = (1, 'first-name', 'last-name', 'example@example.com')
    conn = Connection(shared_instance, dbapi_database)
    cursor = conn.cursor()
    cursor.execute("\nINSERT INTO contacts (contact_id, first_name, last_name, email)\nVALUES (1, 'first-name', 'last-name', 'example@example.com')\n    ")
    conn.commit()
    cursor.execute("\nUPDATE contacts\nSET first_name = 'updated-first-name'\nWHERE first_name = 'first-name'\n")
    conn.close()
    conn = Connection(shared_instance, dbapi_database)
    cursor = conn.cursor()
    cursor.execute('SELECT * FROM contacts')
    got_rows = cursor.fetchall()
    conn.commit()
    assert (got_rows == [want_row])
    cursor.close()
    conn.close()