Regular user linked to the test org with user role.
(db, org, user_role)
| 293 | |
| 294 | @pytest.fixture |
| 295 | async def regular_user(db, org, user_role): |
| 296 | """Regular user linked to the test org with user role.""" |
| 297 | u = User( |
| 298 | id=2, |
| 299 | username="regular", |
| 300 | first_name="Regular", |
| 301 | last_name="User", |
| 302 | email="regular@test.com", |
| 303 | password="hashed_password", |
| 304 | user_uuid="user_regular", |
| 305 | creation_date=str(datetime.now()), |
| 306 | update_date=str(datetime.now()), |
| 307 | ) |
| 308 | db.add(u) |
| 309 | await db.commit() |
| 310 | await db.refresh(u) |
| 311 | uo = UserOrganization( |
| 312 | user_id=u.id, |
| 313 | org_id=org.id, |
| 314 | role_id=user_role.id, |
| 315 | creation_date=str(datetime.now()), |
| 316 | update_date=str(datetime.now()), |
| 317 | ) |
| 318 | db.add(uo) |
| 319 | await db.commit() |
| 320 | return PublicUser( |
| 321 | id=u.id, |
| 322 | username=u.username, |
| 323 | first_name=u.first_name, |
| 324 | last_name=u.last_name, |
| 325 | email=u.email, |
| 326 | user_uuid=u.user_uuid, |
| 327 | ) |
| 328 | |
| 329 | |
| 330 | @pytest.fixture |
nothing calls this directly
no test coverage detected