Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fishchimp/feature/test unavailability get (#185)
## Describe your changes Deleted redundant tests to get vehicle list. Made unit tests for the unavailability fetch (get) method. Test 1: Success Retrieval of Unavailability Records Objective: Verify that the system can successfully retrieve unavailability records for a volunteer with existing records. Criteria: - The response status code must be 200, indicating a successful request. - The response must contain an 'unavailability' key, showing that unavailability data is being returned. - The 'unavailability' key must be associated with a list, indicating one or more unavailability records are present. Test 2: No Unavailability Records Found Objective: Confirm the system's response when a valid volunteer has no unavailability records. Criteria: - The response status code should be 400, indicating a client-side error due to the absence of records. - To inform the client about the lack of records, the response body must explicitly indicate failure, with a structure matching {'userID': user_id, 'success': False}. Test 3: Invalid Volunteer User ID Objective: Ensure the system correctly handles requests for non-existent users. Criteria: - The response status code should be 404, indicating that the requested resource (user or unavailability record) was not found. - The response should include a message indicating the user was not found, making the error clear to the client. Test 4: Unauthorized Access Attempt Objective: Test the system's response to an unauthorized request by simulating a scenario in which the requestor is not authenticated. Criteria: - The response status code must be 401, signalling unauthorized access due to lack of or invalid authentication. - The response must contain an error message, providing feedback that authentication is required. Test 5: Forbidden Access Attempt Objective: Validate the system's handling of requests from authenticated users who do not have permission to access the requested data. Criteria: - The response status code should be 403, indicating that the requestor is authenticated but lacks the necessary permissions to access the requested resource. - The response must include an error message indicating the requestor's insufficient permissions. ## Issue ticket number and link [Issue FE-146](https://fireapp-emergiq-2024.atlassian.net/browse/FE-146) --------- Co-authored-by: Muhammad Hafizh Hasyim <[email protected]>
- Loading branch information