Example #1
0
def fill_database(connection):
  users = data.users()
  for user in users:
    insert_user(connection, user)
  tasks = data.tasks()
  for task in tasks:
    insert_task(connection, task)
Example #2
0
def test_users_and_insert_user():
    connection = model.connect(":memory:")
    model.create_database(connection)
    users = data.users()
    model.insert_user(connection, users[1])
    model.insert_user(connection, users[0])
    assert model.users(connection) == [users[0], users[1]]
Example #3
0
def test_tasks_and_insert_task():
    connection = model.connect(":memory:")
    model.create_database(connection)
    tasks = data.tasks()
    users = data.users()
    model.insert_user(connection, users[0])
    model.insert_user(connection, users[1])
    model.insert_task(connection, tasks[6])
    model.insert_task(connection, tasks[1])
    model.insert_task(connection, tasks[5])
    assert model.tasks(connection) == [tasks[1], tasks[5], tasks[6]]
Example #4
0
def test_user():
    connection = model.connect(":memory:")
    model.create_database(connection)
    model.fill_database(connection)
    for user in data.users():
        assert model.user(connection, user['id']) == user
Example #5
0
def test_fill_database():
    connection = model.connect(":memory:")
    model.create_database(connection)
    model.fill_database(connection)
    assert model.users(connection) == data.users()
    assert model.tasks(connection) == data.tasks()