Beispiel #1
0
def test_get_user_by_id():
    """a user can be retrieved from the app"""
    store = Store()
    quiz_id = store.create_quiz(FakeSource)
    user_id = store.create_user(quiz_id, "Someone", False)
    user = store.get_user_by_id(user_id)
    assert user
Beispiel #2
0
def test_create_user():
    """a user can be added to the store and quiz"""
    store = Store()
    quiz_id = store.create_quiz(FakeSource)
    user_id = store.create_user(quiz_id, "Someone", False)
    user = store.users[user_id]
    assert user
Beispiel #3
0
def test_get_users_by_id():
    """answers can be retrieved from the app"""
    store = Store()
    quiz_id = store.create_quiz(FakeSource)
    user_id_one = store.create_user(quiz_id, "Someone", False)
    user_id_two = store.create_user(quiz_id, "Someone", False)

    users = store.get_users_by_id([user_id_one, user_id_two])
    assert type(users) is list
Beispiel #4
0
def filled_store():
    """Creates a somewhat larger app to test that no extra things are added"""
    store = Store()

    quiz_count = 0
    question_count = 0
    user_count = 0

    for _ in range(3):
        quiz_id = store.create_quiz(FakeSource)
        quiz_count += 1

        for _ in range(5):
            store.create_question_from_source(quiz_id)
            question_count += 1

        for _ in range(8):
            store.create_user(quiz_id, "Someone", False)
            user_count += 1

    return store