from .test_payloads.payload_application_router import * # create an application def test_create_application_consumer(test_client, consumer_header): payload = create_application_payload url = "/application" response = test_client.post(url, json=payload, headers=consumer_header) assert response.status_code == 200 response = response.json() assert response["status"] == 200 assert response["message"] == "Application created successfully!" # fetch an application def test_get_application_consumer(test_client, consumer_header, application_id): url = f"/application/{application_id}" response = test_client.get(url, headers=consumer_header) assert response.status_code == 200 response = response.json() assert response["status"] == 200 assert response["message"] == "Application fetched successfully!" # create new user profile def test_add_personal_details_consumer(test_client, consumer_header): payload = add_profile_payload url = "/application/personal_details" response = test_client.post(url, json=payload, headers=consumer_header) assert response.status_code == 200 response = response.json() assert response["status"] == 200 if response["message"] == "Personal details updated successfully!": assert response["message"] == "Personal details updated successfully!" elif response["message"] == "Personal Details saved successfully!": assert response["message"] == "Personal Details saved successfully!" # updated user profile details def test_update_personal_details_consumer(test_client, consumer_header, application_id): payload = update_profile_payload url = f"/application/personal_details/{application_id}" response = test_client.put(url, json=payload, headers=consumer_header) if response.status_code == 404: assert response.status_code == 404 response = response.json() assert response["status"] == 404 assert response["message"] == "Application not found" else: assert response.status_code == 200 response = response.json() assert response["status"] == 200 assert response["message"] == "Personal details updated successfully!" # add loan details to the application def test_add_loan_details_consumer(test_client, consumer_header): payload = add_loan_details_payload url = "/application/loan" response = test_client.post(url, json=payload, headers=consumer_header) assert response.status_code == 200 response = response.json() assert response["status"] == 200 if response["message"] == "Loan updated successfully!": assert response["message"] == "Loan updated successfully!" elif response["message"] == "Loan Details saved successfully!": assert response["message"] == "Loan Details saved successfully!" # update existing loan details def test_update_loan_details_consumer(test_client, consumer_header, application_id): payload = update_loan_details_payload url = f"/application/loan/{application_id}" response = test_client.put(url, json=payload, headers=consumer_header) if response.status_code == 404: assert response.status_code == 404 response = response.json() assert response["status"] == 404 assert response["message"] == "Application not found" else: assert response.status_code == 200 response = response.json() assert response["status"] == 200 assert response["message"] == "Loan details updated successfully!" # add employment and income details def test_add_employment_and_income_details_consumer(test_client, consumer_header): payload = add_employment_and_income_payload url = "/application/employment_and_income" response = test_client.post(url, json=payload, headers=consumer_header) assert response.status_code == 200 response = response.json() assert response["status"] == 200 if response["message"] == "Employment And Income Details updated successfully!": assert response["message"] == "Employment And Income Details updated successfully!" elif response["message"] == "Employment And Income Details saved successfully!": assert response["message"] == "Employment And Income Details saved successfully!" # update employment and income details def test_update_employment_and_income_details_consumer(test_client, consumer_header, application_id): payload = update_employment_and_income_payload url = f"/application/employment_and_income/{application_id}" response = test_client.put(url, json=payload, headers=consumer_header) if response.status_code == 404: assert response.status_code == 404 response = response.json() assert response["status"] == 404 assert response["message"] == "Application not found" else: assert response.status_code == 200 response = response.json() assert response["status"] == 200 assert response["message"] == "Employment and Income details updated successfully!" # add assets details def test_add_assets_details_consumer(test_client, consumer_header): payload = add_assets_payload url = "/application/assets" response = test_client.post(url, json=payload, headers=consumer_header) assert response.status_code == 200 response = response.json() assert response["status"] == 200 if response["message"] == "User Asset Details updated successfully!": assert response["message"] == "User Asset Details updated successfully!" elif response["message"] == "Asset Details saved successfully!": assert response["message"] == "Asset Details saved successfully!" # update assets details def test_update_assets_details_consumer(test_client, consumer_header, application_id): payload = update_assests_payload url = f"/application/assets/{application_id}" response = test_client.put(url, json=payload, headers=consumer_header) if response.status_code == 404: assert response.status_code == 404 response = response.json() assert response["status"] == 404 assert response["message"] == "Application not found" else: assert response.status_code == 200 response = response.json() assert response["status"] == 200 assert response["message"] == "Asset details updated successfully!" # add liability details def test_add_liability_details_consumer(test_client, consumer_header): payload = add_liability_payload url = "/application/liabilities" response = test_client.post(url, json=payload, headers=consumer_header) assert response.status_code == 200 response = response.json() assert response["status"] == 200 if response["message"] == "User Libalities Details updated successfully!": assert response["message"] == "User Libalities Details updated successfully!" elif response["message"] == "Libality Details saved successfully!": assert response["message"] == "Libality Details saved successfully!" # update liability details def test_update_liability_details_consumer(test_client, consumer_header, application_id): payload = update_liability_payload url = f"/application/liabilities/{application_id}" response = test_client.put(url, json=payload, headers=consumer_header) if response.status_code == 404: assert response.status_code == 404 response = response.json() assert response["status"] == 404 assert response["message"] == "Application not found" else: assert response.status_code == 200 response = response.json() assert response["status"] == 200 assert response["message"] == "Libality details updated successfully!" # add REOs details def test_add_reos_details_consumer(test_client, consumer_header): payload = add_reo_payload url = "/application/reos" response = test_client.post(url, json=payload, headers=consumer_header) assert response.status_code == 200 response = response.json() assert response["status"] == 200 if response["message"] == "User REOs updated successfully!": assert response["message"] == "User REOs updated successfully!" elif response["message"] == "User REOs Details saved successfully!": assert response["message"] == "User REOs Details saved successfully!" # update REOs details def test_update_reo_details_consumer(test_client, consumer_header, application_id): payload = update_reo_payload url = f"/application/reos/{application_id}" response = test_client.put(url, json=payload, headers=consumer_header) if response.status_code == 404: assert response.status_code == 404 response = response.json() assert response["status"] == 404 assert response["message"] == "Application not found" else: assert response.status_code == 200 response = response.json() assert response["status"] == 200 assert response["message"] == "User REOs details updated successfully!"