Test state: assertion error
This commit is contained in:
parent
1196424bbd
commit
9750ab5454
|
@ -35,10 +35,8 @@ class SQLiteDatabaseRepository(AbstractDatabaseRepository):
|
|||
self.conn = sqlite3.connect(self.path)
|
||||
self.cursor = self.conn.cursor()
|
||||
|
||||
def _namedtuple_factory(cursor, row, raw_tuples):
|
||||
# TODO: fix that. Here causes errors. Or remove namedtyples and use normal index tuple. Also, row - is cursor
|
||||
# Good luck
|
||||
fields = [column[0] for column in row.description]
|
||||
def _namedtuple_factory(row, cursor, raw_tuples):
|
||||
fields = [column[0] for column in cursor.description]
|
||||
cls = namedtuple("Row", fields)
|
||||
return cls._make(raw_tuples)
|
||||
|
||||
|
@ -52,7 +50,7 @@ class SQLiteDatabaseRepository(AbstractDatabaseRepository):
|
|||
def get_user_by_id(self, user_id: str) -> User:
|
||||
"""Get user by user id"""
|
||||
|
||||
self.conn.row_factory = self._namedtuple_factory # Error here, not use named
|
||||
self.conn.row_factory = self._namedtuple_factory
|
||||
|
||||
self.cur_userdata = self.conn.execute(
|
||||
"SELECT user_id AS user_id, first_name AS first_name, last_name AS last_name, username AS username, avatar_hash AS avatar_hash FROM platforms_users WHERE user_id = (?)",
|
||||
|
@ -65,9 +63,9 @@ class SQLiteDatabaseRepository(AbstractDatabaseRepository):
|
|||
return UserNotFoundError("User not found!")
|
||||
|
||||
return User(
|
||||
id=user_id,
|
||||
first_name=self.userdata.user_id,
|
||||
last_name=self.userdata.first_name,
|
||||
user_id=self.userdata.user_id,
|
||||
first_name=self.userdata.first_name,
|
||||
last_name=self.userdata.last_name,
|
||||
username=self.userdata.username,
|
||||
avatar_hash=self.userdata.avatar_hash,
|
||||
)
|
||||
|
@ -90,7 +88,6 @@ class SQLiteDatabaseRepository(AbstractDatabaseRepository):
|
|||
return UserAlreadyExistError("User already exist!")
|
||||
|
||||
self.conn.commit()
|
||||
|
||||
return self.get_user_by_id(user_id=user.user_id)
|
||||
|
||||
def update_user(self) -> None:
|
||||
|
|
Reference in a new issue