rastof9 commited on
Commit
4f1c462
·
verified ·
1 Parent(s): 59b6942

Create test_db.py

Browse files
Files changed (1) hide show
  1. test_db.py +20 -0
test_db.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # test_db.py
2
+ import database
3
+
4
+ print("--- Testing Database Connection ---")
5
+
6
+ # Use a dummy user ID and username for the test
7
+ test_user_id = 12345
8
+ test_username = "testuser"
9
+
10
+ print(f"Attempting to get or create user: {test_user_id} ({test_username})")
11
+ user_data = database.get_or_create_user(test_user_id, test_username)
12
+
13
+ if user_data:
14
+ print("\n✅ Test successful!")
15
+ print("Received user data:")
16
+ print(user_data)
17
+ print("\nCheck your 'users' table in the Supabase dashboard. You should see a new entry for 'testuser'.")
18
+ else:
19
+ print("\n❌ Test failed. Please check the error messages above.")
20
+ print("Common issues include incorrect URL/Key in config.py or network connectivity problems.")