def test_results_checksum(shared_instance, dbapi_database):
    'Test that results checksum is calculated properly.'
    conn = Connection(shared_instance, dbapi_database)
    cursor = conn.cursor()
    cursor.execute("\nINSERT INTO contacts (contact_id, first_name, last_name, email)\nVALUES\n(1, 'first-name', 'last-name', 'example@example.com'),\n(2, 'first-name2', 'last-name2', 'example@example.com')\n    ")
    assert (len(conn._statements) == 1)
    conn.commit()
    cursor.execute('SELECT * FROM contacts')
    got_rows = cursor.fetchall()
    assert (len(conn._statements) == 1)
    conn.commit()
    checksum = hashlib.sha256()
    checksum.update(pickle.dumps(got_rows[0]))
    checksum.update(pickle.dumps(got_rows[1]))
    assert (cursor._checksum.checksum.digest() == checksum.digest())
Test that results checksum is calculated properly.
def test_results_checksum(shared_instance, dbapi_database):
    
    conn = Connection(shared_instance, dbapi_database)
    cursor = conn.cursor()
    cursor.execute("\nINSERT INTO contacts (contact_id, first_name, last_name, email)\nVALUES\n(1, 'first-name', 'last-name', 'example@example.com'),\n(2, 'first-name2', 'last-name2', 'example@example.com')\n    ")
    assert (len(conn._statements) == 1)
    conn.commit()
    cursor.execute('SELECT * FROM contacts')
    got_rows = cursor.fetchall()
    assert (len(conn._statements) == 1)
    conn.commit()
    checksum = hashlib.sha256()
    checksum.update(pickle.dumps(got_rows[0]))
    checksum.update(pickle.dumps(got_rows[1]))
    assert (cursor._checksum.checksum.digest() == checksum.digest())