MCPcopy
hub / github.com/learnhouse/learnhouse / admin_user

Function admin_user

apps/api/src/tests/conftest.py:259–291  ·  view source on GitHub ↗

Admin user linked to the test org with admin role.

(db, org, admin_role)

Source from the content-addressed store, hash-verified

257
258@pytest.fixture
259async 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

Callers

nothing calls this directly

Calls 4

UserClass · 0.90
UserOrganizationClass · 0.90
PublicUserClass · 0.90
commitMethod · 0.80

Tested by

no test coverage detected