-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_test_user.py
More file actions
43 lines (37 loc) · 1.25 KB
/
create_test_user.py
File metadata and controls
43 lines (37 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""
Create a test user for manual testing
"""
import uuid
from sqlalchemy.orm import Session
from app.db import SessionLocal
from app.models.users.models import User, UserRole
from app.auth.password import hash_password
def create_test_user():
"""Create a test user for manual testing"""
with SessionLocal() as db:
# Check if test user already exists
existing_user = db.query(User).filter(User.email == "test@example.com").first()
if existing_user:
print(f"Test user already exists: {existing_user.email}")
return existing_user.id
# Create test user
test_user = User(
id=str(uuid.uuid4()),
email="test@example.com",
password_hash=hash_password("TestPass123!"),
first_name="Test",
last_name="User",
role=UserRole.TENANT_USER.value,
tenant_id="default",
is_active=True,
email_verified=True
)
db.add(test_user)
db.commit()
db.refresh(test_user)
print(f"Created test user: {test_user.email}")
print(f"Password: TestPass123!")
print(f"Tenant ID: {test_user.tenant_id}")
return test_user.id
if __name__ == "__main__":
create_test_user()