def test_application_update_details_api(session, client, jwt): token = factory_auth_header() headers = { "Authorization": f"Bearer {token}", "content-type": "application/json", } rv = client.post("/form", headers=headers, json=get_form_request_payload()) assert rv.status_code == 201 form_id = rv.json.get("formId") rv = client.post( "/application/create", headers=headers, json=get_application_create_payload(form_id), ) assert rv.status_code == 201 application_id = rv.json.get("id") rv = client.get(f"/application/{application_id}", headers=headers) payload = rv.json() payload["applicationStatus"] = "New" rv = client.put(f"/application/{application_id}", headers=headers, json=payload) assert rv.status_code == 200 assert rv.json() == "Updated successfully"
def test_post_application_history_create_method(client, jwt): token = factory_auth_header() headers = { "Authorization": f"Bearer {token}", "content-type": "application/json" } rv = client.post("/form", headers=headers, json=get_form_request_payload()) assert rv.status_code == 201 form_id = rv.json.get("formId") rv = client.post( "/application/create", headers=headers, json=get_application_create_payload(form_id), ) assert rv.status_code == 201 application_id = rv.json.get("applicationId") new_application = client.post( f"/application/{application_id}/history", headers=headers, json={ "applicationId": 1, "applicationStatus": "New", "formUrl": "http://testsample.com/form/23/submission/3423", }, ) assert new_application.status_code == 201
def test_get_application_history(client, jwt): """Get the json request for application /application/{application_id}/history""" token = factory_auth_header() headers = { "Authorization": f"Bearer {token}", "content-type": "application/json" } rv = client.post("/form", headers=headers, json=get_form_request_payload()) assert rv.status_code == 201 form_id = rv.json.get("formId") rv = client.post( "/application/create", headers=headers, json=get_application_create_payload(form_id), ) assert rv.status_code == 201 ## This application create fails because of pessimistic DB management application_id = rv.json.get("applicationId") rv = client.get(f"/application/{application_id}/history", headers=headers) assert rv.status_code == 200
def test_metrics_detailed_view(orderBy, session, client, jwt, app): token = jwt.create_jwt(get_token_body(), get_token_header()) headers = { "Authorization": f"Bearer {token}", "content-type": "application/json" } rv = client.post("/form", headers=headers, json=get_form_request_payload()) assert rv.status_code == 201 form_id = rv.json.get("formId") mapper_id = rv.json.get("id") rv = client.post( "/application/create", headers=headers, json=get_application_create_payload(form_id), ) assert rv.status_code == 201 today = date.today().strftime("%Y-%m-%d") rv = client.get( f"/metrics/{mapper_id}?from={today}&to={today}&orderBy={orderBy}", headers=headers, ) assert rv.status_code == 200 assert rv.json.get("applications")
def test_application_create_method(session, client, jwt): token = factory_auth_header() headers = { "Authorization": f"Bearer {token}", "content-type": "application/json", } rv = client.post("/form", headers=headers, json=get_form_request_payload()) assert rv.status_code == 201 form_id = rv.json.get("formId") rv = client.post( "/application/create", headers=headers, json=get_application_create_payload(form_id), ) assert rv.status_code == 201
def test_application_submission(self, session, client, jwt): token = factory_auth_header() headers = { "Authorization": f"Bearer {token}", "content-type": "application/json", } rv = client.post("/form", headers=headers, json=get_form_request_payload()) assert rv.status_code == 201 form_id = rv.json.get("formId") rv = client.post( "/application/create", headers=headers, json=get_application_create_payload(form_id), ) assert rv.status_code == 201 response = client.get("/application/formid/61b81b6f85589c44f62865c7", headers=headers) assert response.status_code == 200