Skip to content

Instantly share code, notes, and snippets.

@eteamin
Created November 23, 2016 12:04
Show Gist options
  • Save eteamin/7adc5790ad50c8f5b5484c2822598efc to your computer and use it in GitHub Desktop.
Save eteamin/7adc5790ad50c8f5b5484c2822598efc to your computer and use it in GitHub Desktop.
import sqlite3
from blackfield.variables import DB_FILE, DB_TEST_FILE, TEST_PERSON, INVALID_CART
if __name__ == '__main__':
connection = sqlite3.connect(DB_FILE)
cursor = connection.cursor()
try:
# Create the db
cursor.execute(
"""
CREATE TABLE people (id int primary_key, name char, code int unique);
"""
)
except sqlite3.OperationalError as ex:
print('Creating db failed due to %s' % str(ex))
for i in [722491324164, 8810723724198, 882004024160, 88351112412]:
try:
# Insert row for invalid card
values = ('Test', i)
cursor.execute(
"""
INSERT INTO people (name, code) VALUES (?, ?);
""",
values
)
except sqlite3.OperationalError as ex:
print('Inserting test data failed due to %s' % str(ex))
connection.commit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment