@@ -115,18 +115,18 @@ def register_user(self) -> bool:
115115 self .log ("✅ User registered successfully" )
116116 return True
117117 else :
118- self .log (f "❌ Registration redirect unexpected: { location } " , "ERROR" )
118+ self .log ("❌ Registration redirect unexpected" , "ERROR" )
119119 return False
120120 elif response .status_code == 200 :
121121 # Check if it's a success response
122122 if 'success' in response .text .lower () or 'dashboard' in response .text .lower ():
123123 self .log ("✅ User registered successfully" )
124124 return True
125125 else :
126- self .log (f "❌ Registration form error: { response . text [: 200 ] } " , "ERROR" )
126+ self .log ("❌ Registration form error" , "ERROR" )
127127 return False
128128 else :
129- self .log (f"❌ User registration failed: HTTP { response .status_code } - { response . text [: 200 ] } " , "ERROR" )
129+ self .log (f"❌ User registration failed: HTTP { response .status_code } " , "ERROR" )
130130 return False
131131
132132 except Exception as e :
@@ -163,18 +163,18 @@ def login_user(self) -> bool:
163163 self .log ("✅ User logged in successfully" )
164164 return True
165165 else :
166- self .log (f "❌ Login redirect unexpected: { location } " , "ERROR" )
166+ self .log ("❌ Login redirect unexpected" , "ERROR" )
167167 return False
168168 elif response .status_code == 200 :
169169 # Check if it's a success response
170170 if 'dashboard' in response .text .lower () and 'error' not in response .text .lower ():
171171 self .log ("✅ User logged in successfully" )
172172 return True
173173 else :
174- self .log (f "❌ Login form error: { response . text [: 200 ] } " , "ERROR" )
174+ self .log ("❌ Login form error" , "ERROR" )
175175 return False
176176 else :
177- self .log (f"❌ User login failed: HTTP { response .status_code } - { response . text [: 200 ] } " , "ERROR" )
177+ self .log (f"❌ User login failed: HTTP { response .status_code } " , "ERROR" )
178178 return False
179179
180180 except Exception as e :
@@ -208,7 +208,6 @@ def create_project(self) -> bool:
208208 if response .status_code in [302 , 301 ]:
209209 # Extract project ID from Location header
210210 location = response .headers .get ('Location' , '' )
211- self .log (f"Redirect location: { location } " )
212211
213212 if '/dashboard/projects/' in location and location != f"{ self .base_url } /dashboard/projects/create" :
214213 # Extract project ID from URL like /dashboard/projects/uuid-here
@@ -217,7 +216,7 @@ def create_project(self) -> bool:
217216 project_part = path_parts [1 ].split ('/' )[0 ] # Get first part after projects/
218217 if project_part and len (project_part ) > 10 : # Should be a UUID
219218 self .created_project_id = project_part
220- self .log (f"✅ Project created successfully: { project_data ['name' ]} (ID: { self . created_project_id } ) " )
219+ self .log (f"✅ Project created successfully: { project_data ['name' ]} " )
221220 return True
222221
223222 # If we get redirected back to projects list, try to find the project there
@@ -233,13 +232,13 @@ def create_project(self) -> bool:
233232 matches = re .findall (uuid_pattern , projects_response .text )
234233 if matches :
235234 self .created_project_id = matches [- 1 ] # Get the last (newest) project
236- self .log (f"✅ Project created successfully: { project_data ['name' ]} (ID: { self . created_project_id } ) " )
235+ self .log (f"✅ Project created successfully: { project_data ['name' ]} " )
237236 return True
238237
239- self .log (f "❌ Project creation: Redirect location unclear - { location } " , "ERROR" )
238+ self .log ("❌ Project creation: Redirect location unclear" , "ERROR" )
240239 return False
241240 else :
242- self .log (f"❌ Project creation failed: HTTP { response .status_code } - { response . text [: 200 ] } " , "ERROR" )
241+ self .log (f"❌ Project creation failed: HTTP { response .status_code } " , "ERROR" )
243242 return False
244243
245244 except Exception as e :
@@ -351,7 +350,7 @@ def create_additional_api_key(self) -> bool:
351350 self .log (f"❌ Failed to retrieve API key after creation: HTTP { response .status_code } " , "ERROR" )
352351 return False
353352 else :
354- self .log (f"❌ API key creation failed: HTTP { response .status_code } - { response . text [: 200 ] } " , "ERROR" )
353+ self .log (f"❌ API key creation failed: HTTP { response .status_code } " , "ERROR" )
355354 return False
356355
357356 except Exception as e :
@@ -390,41 +389,22 @@ def test_safe_content_moderation(self) -> bool:
390389 timeout = 120 # Longer timeout for GPT-5 processing
391390 )
392391
393- self .log (f"Safe content response: { response .status_code } " )
394-
395392 if response .status_code == 200 :
396393 data = response .json ()
397- self .log (f"Safe content response: success={ data .get ('success' )} , status={ data .get ('status' )} " )
398394
399395 if data .get ('success' ):
400396 status = data .get ('status' )
401397 if status == 'approved' :
402398 self .log (f"✅ Safe content moderation passed: { status } " )
403- self .log (f" Content ID: { data .get ('content_id' )} " )
404- moderation_results = data .get ('moderation_results' , [])
405- if moderation_results :
406- self .log (f" Moderation details: { moderation_results [0 ].get ('reason' , 'No reason' )} " )
407399 return True
408400 else :
409401 self .log (f"❌ Safe content was incorrectly { status } " , "ERROR" )
410- self .log (f" Content ID: { data .get ('content_id' )} " )
411- moderation_results = data .get ('moderation_results' , [])
412- if moderation_results :
413- self .log (f" Reason: { moderation_results [0 ].get ('reason' , 'No reason' )} " , "ERROR" )
414402 return False
415403 else :
416- self .log (f "❌ Safe content API returned success=false: { data } " , "ERROR" )
404+ self .log ("❌ Safe content API returned success=false" , "ERROR" )
417405 return False
418406 else :
419- try :
420- error_data = response .json ()
421- error_detail = error_data .get ('error' , 'Unknown error' )
422- except :
423- error_detail = response .text [:500 ]
424-
425407 self .log (f"❌ Safe content moderation failed: HTTP { response .status_code } " , "ERROR" )
426- self .log (f" Error: { error_detail } " , "ERROR" )
427-
428408 return False
429409
430410 except Exception as e :
@@ -463,42 +443,23 @@ def test_suspicious_content_moderation(self) -> bool:
463443 timeout = 120 # Longer timeout for GPT-5 processing
464444 )
465445
466- self .log (f"Suspicious content response: { response .status_code } " )
467-
468446 if response .status_code == 200 :
469447 data = response .json ()
470- self .log (f"Suspicious content response: success={ data .get ('success' )} , status={ data .get ('status' )} " )
471448
472449 if data .get ('success' ):
473450 status = data .get ('status' )
474451 if status in ['rejected' , 'flagged' ]:
475452 self .log (f"✅ Suspicious content was properly moderated: { status } " )
476- self .log (f" Content ID: { data .get ('content_id' )} " )
477- moderation_results = data .get ('moderation_results' , [])
478- if moderation_results :
479- self .log (f" Rule triggered: { moderation_results [0 ].get ('rule_name' , 'Unknown' )} " )
480- self .log (f" Reason: { moderation_results [0 ].get ('reason' , 'No reason' )} " )
481453 return True
482454 else :
483455 self .log (f"❌ Suspicious content was incorrectly { status } - should have been rejected!" , "ERROR" )
484- self .log (f" Content ID: { data .get ('content_id' )} " , "ERROR" )
485- moderation_results = data .get ('moderation_results' , [])
486- if moderation_results :
487- self .log (f" Reason: { moderation_results [0 ].get ('reason' , 'No reason' )} " , "ERROR" )
488456 self .log (" This indicates the AI moderation rules may need adjustment" , "ERROR" )
489457 return False
490458 else :
491- self .log (f "❌ Suspicious content API returned success=false: { data } " , "ERROR" )
459+ self .log ("❌ Suspicious content API returned success=false" , "ERROR" )
492460 return False
493461 else :
494- try :
495- error_data = response .json ()
496- error_detail = error_data .get ('error' , 'Unknown error' )
497- except :
498- error_detail = response .text [:500 ]
499-
500462 self .log (f"❌ Suspicious content moderation failed: HTTP { response .status_code } " , "ERROR" )
501- self .log (f" Error: { error_detail } " , "ERROR" )
502463 return False
503464
504465 except Exception as e :
@@ -523,18 +484,13 @@ def test_api_stats(self) -> bool:
523484 if response .status_code == 200 :
524485 data = response .json ()
525486 if data .get ('success' ):
526- stats = data .get ('stats' , {})
527- self .log (f"✅ API stats retrieved successfully:" )
528- self .log (f" Total content: { stats .get ('total_content' , 0 )} " )
529- self .log (f" Approved: { stats .get ('approved' , 0 )} " )
530- self .log (f" Rejected: { stats .get ('rejected' , 0 )} " )
531- self .log (f" Flagged: { stats .get ('flagged' , 0 )} " )
487+ self .log ("✅ API stats retrieved successfully" )
532488 return True
533489 else :
534- self .log (f "❌ API stats failed: { data } " , "ERROR" )
490+ self .log ("❌ API stats failed" , "ERROR" )
535491 return False
536492 else :
537- self .log (f"❌ API stats failed: HTTP { response .status_code } - { response . text [: 200 ] } " , "ERROR" )
493+ self .log (f"❌ API stats failed: HTTP { response .status_code } " , "ERROR" )
538494 return False
539495
540496 except Exception as e :
@@ -554,7 +510,6 @@ def cleanup(self):
554510 def run_all_tests (self ) -> bool :
555511 """Run simplified end-to-end tests for core platform functionality"""
556512 self .log ("🚀 Starting AutoModerate Core Platform Tests" )
557- self .log (f" Base URL: { self .base_url } " )
558513
559514 # Core platform tests - what we actually need to validate deployment
560515 tests = [
0 commit comments