IEEE.org     |     IEEE Xplore Digital Library     |     IEEE Standards     |     IEEE Spectrum     |     More Sites

Verified Commit ece31abe authored by Emi Simpson's avatar Emi Simpson
Browse files

Adapt tests to new database structure

parent d462f916
Pipeline #103 failed with stage
......@@ -43,10 +43,12 @@ def project(projects: Callable[[str], Project]) -> Iterator[Project]:
@fixture
def users(database: Cursor) -> Iterator[Callable[[str], User]]:
ids: List[int] = []
def new_user(username: str) -> User:
def new_user(username: str, name: str = None) -> User:
if name is None:
name = username
database.execute("""
INSERT INTO users(username) VALUES (?);
""", (username,))
INSERT INTO users(username, name) VALUES (?, ?);
""", (username, name))
uid = database.lastrowid
ids.append(uid)
return User(database, uid)
......@@ -331,12 +333,12 @@ class TestUser:
assert source_set == {sources[0], sources[1], sources[4], sources[5]}
def test_create_project(self, database: Cursor) -> None:
u = User.create_user(database, "alch_emi")
u = User.create_user(database, 1312, "alch_emi", "Emi")
record = database.execute("""
SELECT * FROM users WHERE user_id = ?;
""", (u.user_id,))
assert next(record) == (u.user_id, "alch_emi")
assert next(record) == (1312, "alch_emi", "Emi")
database.execute("""
DELETE FROM users WHERE user_id = ?;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment