Spaces:
Runtime error
Runtime error
|
Download TESTING_FLOWS.md from Amitkasar/ai-api-testing: direct link, hf CLI and curl.
- Browser
- Download file 7.5 kB
-
https://huggingface.co/spaces/Amitkasar/ai-api-testing/resolve/main/TESTING_FLOWS.md
- Command line
-
hf download hf://spaces/Amitkasar/ai-api-testing/TESTING_FLOWS.md
-
curl -L -o TESTING_FLOWS.md https://huggingface.co/spaces/Amitkasar/ai-api-testing/resolve/main/TESTING_FLOWS.md
7.5 kB
Testing Flows for EarWax CRM Mobile API
Based on the openapi.yaml specification, here are the end-to-end integration and business flows you can configure and test using this AI API Testing Tool.
1. Authentication & Security Life Cycle Flow
Verify user authentication, session security, token rotation, and clean profile termination.
Scenario Steps:
- User Login:
POST /auth/login- Payload:
{ "username": "exceladmin", "password": "your_secure_password" } - Expectation: Receives
access_tokenandrefresh_tokeninTokenPair, plus theUserobject.
- Payload:
- Retrieve Profile:
GET /auth/me- Headers:
Authorization: Bearer <access_token> - Expectation: Confirms token validation and retrieves profile info.
- Headers:
- Update Profile:
POST /auth/update-profile- Payload:
{ "full_name": "Admin Tester", "email": "admin@earwaxcrm.com" } - Expectation: Patches profile info and returns the updated
Userobject.
- Payload:
- Token Rotation:
POST /auth/refresh- Payload:
{ "refresh_token": "<refresh_token>" } - Expectation: Rotates the old refresh token and issues a new
TokenPair.
- Payload:
- Change Password:
POST /auth/change-password- Payload:
{ "current_password": "your_secure_password", "new_password": "new_secure_password123" } - Expectation: Password changed. All active sessions are invalidated.
- Payload:
- Logout:
POST /auth/logout- Expectation: Invalidates active tokens immediately.
2. Lead Intake & Management Flow
Tests onboarding a new prospect, registering communication notes, and transitioning them through the sales pipeline.
Scenario Steps:
- Authentication: Log in to obtain a Bearer token.
- Create Prospect Lead:
POST /leads/create- Payload:
{ "first_name": "John", "last_name": "Smith", "email": "john.smith@example.com", "phone": "+447700900077", "qualification": "BSc Audio", "status": "new", "source": "Mobile App", "notes": "Interested in Ear Wax Removal Course." } - Expectation: Returns
lead_id(e.g.,45). Triggers push notification to admins.
- Payload:
- Inspect Lead Details:
GET /leads/detail- Query Parameters:
?id=<lead_id> - Expectation: Retrieves full profile, empty appointments array, and the "Lead Created" activity entry.
- Query Parameters:
- Append Operator Note:
POST /leads/add-note- Payload:
{ "id": <lead_id>, "note": "Called prospect. Requested booking options." } - Expectation: Modifies the plain-text notes and logs a new activity entry.
- Payload:
- Update Pipeline Status:
POST /leads/update-status- Payload:
{ "id": <lead_id>, "status": "planned_later" } - Expectation: Success response. (Fires automatic system email/SMS triggers).
- Payload:
- Archive Prospect:
POST /leads/archive(Admin only)- Payload:
{ "id": <lead_id>, "archive": true } - Expectation: Lead marked as archived, cancelling any scheduled follow-up notifications.
- Payload:
3. Student Lead-to-Booking Conversion Flow
The core CRM revenue flow. Tests converting an interested lead into an active student with a booked course, payment confirmation, and invoice creation.
Scenario Steps:
- Select Available Course:
GET /courses- Expectation: Retrieves list of active courses. Note down a
course_idand training details.
- Expectation: Retrieves list of active courses. Note down a
- Onboard Student Lead:
POST /leads/create- Payload:
{ "first_name": "Jane", "email": "jane.doe@example.com", "status": "new" } - Expectation: Returns new
lead_id.
- Payload:
- Book Appointment:
POST /appointments/create- Payload:
{ "lead_id": <lead_id>, "course_id": <course_id>, "appointment_date": "2026-06-15", "appointment_time": "09:00", "amount_paid": 499.00, "payment_method": "Stripe", "status": "pending" } - Expectation: Returns
appointment_idand a uniqueappointment_ref(e.g.,APT-W4X5Y6).
- Payload:
- Inspect Lead Funnel Status:
GET /leads/detail- Query Parameters:
?id=<lead_id> - Expectation: Confirms the appointment is now linked and listed in the lead's appointments array.
- Query Parameters:
- Confirm and Pay Booking:
POST /appointments/update-status- Payload:
{ "id": <appointment_id>, "status": "confirmed" } - Expectation: Status successfully transitioned (fires push notifications to admins and updates revenue analytics).
- Payload:
- Generate PDF Invoice:
GET /invoice/pdf- Query Parameters:
?id=<appointment_id> - Expectation: Streams an A4-format PDF file (
Content-Type: application/pdf).
- Query Parameters:
4. Mobile Push Notification & Registration Flow
Tests device token management and clean session tear-down for mobile apps.
Scenario Steps:
- Device Registration:
POST /devices/register- Payload:
{ "push_token": "ExponentPushToken[12345abcde67890fghij]", "platform": "ios", "device_name": "Developer iPad Air" } - Expectation: Registers device token linked to active user. Safe to trigger on every startup.
- Payload:
- Trigger Event Notification: Run either Lead Creation or Appointment Status Update.
- Expectation: The backend triggers Expo Push notifications for admins.
- Device Deregistration via Logout:
POST /auth/logout- Payload:
{ "push_token": "ExponentPushToken[12345abcde67890fghij]" } - Expectation: Unregisters only this specific device token during user sign-out.
- Payload:
5. Administrative Dashboard & User Audit Flow
Tests management reporting, staff accounts auditing, and access control.
Scenario Steps:
- Fetch Dashboard Summary:
GET /stats/dashboard- Expectation: Retrieves KPIs (total leads, enrolled count, upcoming appointments) and lists the 5 most recent leads.
- Fetch Financial & Pipeline Analytics:
GET /stats(Admin only)- Query Parameters:
?date_from=2026-01-01&date_to=2026-06-30 - Expectation: Returns detailed monthly revenue charts, lead breakdown by state, and main referral sources.
- Query Parameters:
- Audit Staff List:
GET /users(Admin only)- Expectation: Lists all registered CRM staff accounts.
- Provision Staff Account:
POST /users/create(Admin only)- Payload:
{ "username": "staff_jane", "password": "TemporaryPassword123", "full_name": "Jane Staff", "email": "jane.staff@earwaxcrm.com", "role": "staff" } - Expectation: Returns new
user_id.
- Payload:
- Deactivate Staff Member:
POST /users/deactivate(Admin only)- Payload:
{ "id": <user_id>, "active": false } - Expectation: Instantly revokes all active tokens for that staff member.
- Payload:
6. Global Search & Lookup Flow
Tests operators' ability to quickly find and filter data across the system.
Scenario Steps:
- Full-Text Lead Lookup:
GET /search- Query Parameters:
?q=Smith - Expectation: Retrieves matching non-archived leads (up to 30 results). Minimum query is 2 characters.
- Query Parameters:
- Paginated Lead Listing with Filter:
GET /leads- Query Parameters:
?status=new&search=Jane&sort=created_at&dir=desc - Expectation: Returns sorted and filtered search results in paginated format.
- Query Parameters: