40 lines
802 B
Python
40 lines
802 B
Python
import pytest
|
|
import os
|
|
|
|
from mirrortea.models.user import User
|
|
from mirrortea.repository import repository
|
|
|
|
|
|
PATH = "tests/test_database.db"
|
|
|
|
|
|
def create_repository_object():
|
|
return repository(PATH)
|
|
|
|
|
|
def test_create_tables():
|
|
os.system("rm -f " + PATH)
|
|
repo = create_repository_object()
|
|
assert repo.create_tables() is None
|
|
|
|
|
|
def test_create_user():
|
|
repo = create_repository_object()
|
|
assert (
|
|
repo.create_user(
|
|
User(
|
|
user_id="123",
|
|
first_name="dettlaff",
|
|
# last_name=None,
|
|
# username=None,
|
|
# avatar_hash=None,
|
|
)
|
|
)
|
|
is None
|
|
)
|
|
|
|
|
|
def test_get_user_by_id():
|
|
repo = create_repository_object()
|
|
assert repo.get_user_by_id(user_id="123") is None
|