-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathcreate_test_user.py
More file actions
48 lines (40 loc) · 1.31 KB
/
create_test_user.py
File metadata and controls
48 lines (40 loc) · 1.31 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
44
45
46
47
#!/usr/bin/env python3
"""
Create a test user for logging in
"""
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
from __init__ import app, db
from model.user import User
def create_test_user():
with app.app_context():
# Check if user already exists
existing_user = User.query.filter_by(_uid='testuser').first()
if existing_user:
print("❌ Test user 'testuser' already exists!")
print(f" Name: {existing_user.name}")
print(f" UID: {existing_user.uid}")
print(f" Password: 123456")
return
# Create a new test user
print("Creating test user...")
user = User(
name="Test User",
uid="testuser",
password="123456", # Simple password for testing
role="Student"
)
# Save to database
user.create()
print("\n" + "="*50)
print("✅ TEST USER CREATED SUCCESSFULLY!")
print("="*50)
print(f"Username: testuser")
print(f"Password: 123456")
print(f"Name: Test User")
print(f"Role: Student")
print("="*50)
print("\n📌 Use these credentials to log in to your frontend!")
if __name__ == '__main__':
create_test_user()