fix(email_sending): use the template created and stored in mongodb

This commit is contained in:
YuehuCao 2025-08-14 21:35:14 +08:00
parent d829cbf90d
commit b8aa0cf2b9

View File

@ -30,7 +30,7 @@ from common.token.token_manager import TokenManager
class TenantNotificationRealIntegrationTest: class TenantNotificationRealIntegrationTest:
def __init__(self): def __init__(self):
self.test_tenant_id = "test_tenant_user" self.test_tenant_id = "test_tenant_user"
self.test_template_id = "welcome_email_tenant_test_tenant_user" # Use assigned tenant template self.test_template_id = "assessment_result_notification_tenant_test_tenant_user" # Use existing tenant template
self.test_recipient_emails = ["*", "*"] # TODO: can use the true email address self.test_recipient_emails = ["*", "*"] # TODO: can use the true email address
self.test_sender_email = "freeleaps@freeleaps.com" self.test_sender_email = "freeleaps@freeleaps.com"
self.base_url = "http://localhost:8014/api/notification" self.base_url = "http://localhost:8014/api/notification"
@ -98,33 +98,26 @@ class TenantNotificationRealIntegrationTest:
"template_id": self.test_template_id, "template_id": self.test_template_id,
"recipient_emails": self.test_recipient_emails, "recipient_emails": self.test_recipient_emails,
"subject_properties": { "subject_properties": {
"company_name": "TestCompany", "candidate_name": "TestCandidate"
"new_employee_name": "TestUser"
}, },
"body_properties": { "body_properties": {
"manager_name": "TestManager", "candidate_name": "TestCandidate",
"email_address": "test@example.com", "company_name": "TestCompany",
"initial_password": "temp123",
"it_support_email": "it@testcompany.com",
"company_address": "123 Test Street, Test City",
"company_policies_url": "https://testcompany.com/policies",
"start_date": "2024-01-15",
"onboarding_schedule": "Week 1: Orientation, Week 2: Training",
"company_phone": "+1-555-0123",
"department": "Engineering",
"hr_contact_email": "hr@testcompany.com",
"new_employee_name": "TestUser",
"manager_email": "manager@testcompany.com",
"company_logo": "https://testcompany.com/logo.png", "company_logo": "https://testcompany.com/logo.png",
"system_login_url": "https://app.testcompany.com", "assessment_date": "2024-01-15",
"hr_contact_name": "HR Manager", "execution_status": "Completed",
"employee_handbook_url": "https://testcompany.com/handbook", "duration_minutes": "45",
"position": "Software Engineer", "execution_time": "2024-01-15 10:30:00",
"first_week_schedule": "Monday: Orientation, Tuesday: Training", "total_test_cases": "20",
"employee_id": "EMP001", "test_cases_passed": "18",
"training_materials_url": "https://testcompany.com/training" "pass_rate": "90%",
"detailed_results": "Excellent performance in technical assessment",
"execution_errors": "2 minor syntax errors",
"assessment_conclusion": "Passed with distinction",
"tech_support_email": "tech@testcompany.com",
"tech_support_phone": "+1-555-0123"
}, },
"region": 1, "region": 0,
"sender_email": self.test_sender_email, "sender_email": self.test_sender_email,
"priority": "normal", "priority": "normal",
"tracking_enabled": True "tracking_enabled": True