File size: 15,287 Bytes
ef1ad9e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
from .test_payloads.payload_application_router import *
# fetch consumer dashboard details
def test_get_dashboard_info(test_client, consumer_header, application_id):
url = f"/dashboard/loan_info/{application_id}"
response = test_client.get(url, headers=consumer_header)
if response.status_code == 404:
assert response.status_code == 404
response = response.json()
assert response["status"] == 404
assert response["message"] == "Applications not found"
else:
assert response.status_code == 200
response = response.json()
assert response["status"] == 200
assert response["message"] == "Dashboard Info fetched successfully!"
# fetch loan officer dashboard details
def test_get_dashboard_info_loan_officer(test_client, loan_officer_header):
url = "/dashboard/dashboard_info"
response = test_client.get(url, headers=loan_officer_header)
assert response.status_code == 200
response = response.json()
assert response["status"] == 200
assert response["message"] == "Dashboard Info fetched successfully!"
# fetching lead information for loan officer
def test_get_lead_info_loan_officer(test_client, loan_officer_header):
payload = {"loanOfficerIds": []}
url = "/dashboard/lead_info?page=1&page_size=10&pipeline_mode=false"
response = test_client.post(url, json=payload, headers=loan_officer_header)
if response.status_code == 404:
assert response.status_code == 404
response = response.json()
assert response["status"] == 404
assert response["message"] == "No users found"
else:
assert response.status_code == 200
response = response.json()
assert response["status"] == 200
assert response["message"] == "Lead Info fetched successfully!"
# fetching pipeline information for loan officer
def test_get_pipeline_info_loan_officer(test_client, loan_officer_header):
payload = {"loanOfficerIds": []}
url = "/dashboard/lead_info?page=1&page_size=10&pipeline_mode=true"
response = test_client.post(url, json=payload, headers=loan_officer_header)
if response.status_code == 404:
assert response.status_code == 404
response = response.json()
assert response["status"] == 404
assert response["message"] == "No users found"
else:
assert response.status_code == 200
response = response.json()
assert response["status"] == 200
assert response["message"] == "Lead Info fetched successfully!"
# create new user profile
def test_add_personal_details_loan_officer(test_client, loan_officer_header):
payload = add_profile_payload
url = "/dashboard/personal_details"
response = test_client.post(url, json=payload, headers=loan_officer_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_loan_officer(test_client, loan_officer_header, application_id):
payload = update_profile_payload
url = f"/dashboard/personal_details/{application_id}"
response = test_client.put(url, json=payload, headers=loan_officer_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_loan_officer(test_client, loan_officer_header):
payload = add_loan_details_payload
url = "/dashboard/loan"
response = test_client.post(url, json=payload, headers=loan_officer_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_loan_officer(test_client, loan_officer_header, application_id):
payload = update_loan_details_payload
url = f"/dashboard/loan/{application_id}"
response = test_client.put(url, json=payload, headers=loan_officer_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_loan_officer(test_client, loan_officer_header):
payload = add_employment_and_income_payload
url = "/dashboard/employment_and_income"
response = test_client.post(url, json=payload, headers=loan_officer_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_loan_officer(test_client, loan_officer_header, application_id):
payload = update_employment_and_income_payload
url = f"/dashboard/employment_and_income/{application_id}"
response = test_client.put(url, json=payload, headers=loan_officer_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_loan_officer(test_client, loan_officer_header):
payload = add_assets_payload
url = "/dashboard/assets"
response = test_client.post(url, json=payload, headers=loan_officer_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_loan_officer(test_client, loan_officer_header, application_id):
payload = update_assests_payload
url = f"/dashboard/assets/{application_id}"
response = test_client.put(url, json=payload, headers=loan_officer_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_loan_officer(test_client, loan_officer_header):
payload = add_liability_payload
url = "/dashboard/liabilities"
response = test_client.post(url, json=payload, headers=loan_officer_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_loan_officer(test_client, loan_officer_header, application_id):
payload = update_liability_payload
url = f"/dashboard/liabilities/{application_id}"
response = test_client.put(url, json=payload, headers=loan_officer_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_loan_officer(test_client, loan_officer_header):
payload = add_reo_payload
url = "/dashboard/reos"
response = test_client.post(url, json=payload, headers=loan_officer_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_loan_officer(test_client, loan_officer_header, application_id):
payload = update_reo_payload
url = f"/dashboard/reos/{application_id}"
response = test_client.put(url, json=payload, headers=loan_officer_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!"
# add declaration details
def test_add_declaration_loan_officer(test_client, loan_officer_header):
payload = add_declaration_payload
url = "/dashboard/declaration"
response = test_client.post(url, json=payload, headers=loan_officer_header)
assert response.status_code == 200
response = response.json()
assert response["status"] == 200
assert response["message"] == "User declarations Details saved successfully!"
# update declaration details
def test_update_declaration_loan_officer(test_client, loan_officer_header, application_id):
payload = update_declaration_payload
url = f"/dashboard/declaration/{application_id}"
response = test_client.put(url, json=payload, headers=loan_officer_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 Declaration details updated successfully!"
# add demographics details
def test_add_demographics_loan_officer(test_client, loan_officer_header):
payload = add_demographics_payload
url = "/dashboard/demographics"
response = test_client.post(url, json=payload, headers=loan_officer_header)
assert response.status_code == 200
response = response.json()
assert response["status"] == 200
assert response["message"] == "User demographics Details saved successfully!"
# update demographics details
def test_update_demographics_loan_officer(test_client, loan_officer_header, application_id):
payload = update_demographics_payload
url = f"/dashboard/demographics/{application_id}"
response = test_client.put(url, json=payload, headers=loan_officer_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 Demographic details updated successfully!"
# update application status
def test_update_application_status_loan_officer(test_client, loan_officer_header, application_id):
payload = update_application_status_payload
url = f"/dashboard/status/{application_id}"
response = test_client.put(url, json=payload, headers=loan_officer_header)
if response.status_code == 404:
assert response.status_code == 404
response = response.json()
assert response["status"] == 404
assert response["message"] == "Application not found"
elif response.status_code == 409:
assert response.status_code == 409
response = response.json()
assert response["status"] == 409
assert response["message"] == "Unable to update application status"
else:
assert response.status_code == 200
response = response.json()
assert response["status"] == 200
assert response["message"] == "Application status updated successfully!"
# fetch borrower's profile
def test_fetch_borrower_profile(test_client, loan_officer_header, application_id):
url = f"/dashboard/borrower_profile/{application_id}"
response = test_client.get(url, headers=loan_officer_header)
if response.status_code == 404:
assert response.status_code == 404
response = response.json()
assert response["status"] == 404
assert response["message"] == "Applications not found"
else:
assert response.status_code == 200
response = response.json()
assert response["status"] == 200
assert response["message"] == "Borrower Profile Info fetched successfully!"
|