Admin user linked to the test org with admin role.
(db, org, admin_role)
| 257 | |
| 258 | @pytest.fixture |
| 259 | async def admin_user(db, org, admin_role): |
| 260 | """Admin user linked to the test org with admin role.""" |
| 261 | u = User( |
| 262 | id=1, |
| 263 | username="admin", |
| 264 | first_name="Admin", |
| 265 | last_name="User", |
| 266 | email="admin@test.com", |
| 267 | password="hashed_password", |
| 268 | user_uuid="user_admin", |
| 269 | creation_date=str(datetime.now()), |
| 270 | update_date=str(datetime.now()), |
| 271 | ) |
| 272 | db.add(u) |
| 273 | await db.commit() |
| 274 | await db.refresh(u) |
| 275 | uo = UserOrganization( |
| 276 | user_id=u.id, |
| 277 | org_id=org.id, |
| 278 | role_id=admin_role.id, |
| 279 | creation_date=str(datetime.now()), |
| 280 | update_date=str(datetime.now()), |
| 281 | ) |
| 282 | db.add(uo) |
| 283 | await db.commit() |
| 284 | return PublicUser( |
| 285 | id=u.id, |
| 286 | username=u.username, |
| 287 | first_name=u.first_name, |
| 288 | last_name=u.last_name, |
| 289 | email=u.email, |
| 290 | user_uuid=u.user_uuid, |
| 291 | ) |
| 292 | |
| 293 | |
| 294 | @pytest.fixture |
nothing calls this directly
no test coverage detected