From 608a1d85f3c3782bf5c0a8ef3423f8e968bf43d4 Mon Sep 17 00:00:00 2001 From: Paulina Kujawa Date: Tue, 29 Oct 2024 00:56:50 +0100 Subject: [PATCH 1/4] Prevent errors when individual has no household --- .../needs_adjudication_ticket_services.py | 8 ++-- .../apps/grievance/test_services_utils.py | 46 +++++++++++++++++++ 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/hct_mis_api/apps/grievance/services/needs_adjudication_ticket_services.py b/src/hct_mis_api/apps/grievance/services/needs_adjudication_ticket_services.py index f0365519b0..2955203a96 100644 --- a/src/hct_mis_api/apps/grievance/services/needs_adjudication_ticket_services.py +++ b/src/hct_mis_api/apps/grievance/services/needs_adjudication_ticket_services.py @@ -368,7 +368,7 @@ def mark_as_distinct_individual( individual_to_distinct, ) individual_marked_as_distinct.send(sender=Individual, instance=individual_to_distinct) - household = individual_to_distinct.household - household.refresh_from_db() - if household.active_individuals.count() > 0: - household.unwithdraw() + if household := individual_to_distinct.household: + household.refresh_from_db() + if household.active_individuals.count() > 0: + household.unwithdraw() diff --git a/tests/unit/apps/grievance/test_services_utils.py b/tests/unit/apps/grievance/test_services_utils.py index 08198b31f6..b884ada573 100644 --- a/tests/unit/apps/grievance/test_services_utils.py +++ b/tests/unit/apps/grievance/test_services_utils.py @@ -408,6 +408,52 @@ def test_close_needs_adjudication_ticket_service(self) -> None: assert ind_1.duplicate is False assert ind_2.duplicate is True + def test_close_needs_adjudication_ticket_service_individual_without_household(self) -> None: + user = UserFactory() + ba = BusinessAreaFactory(slug="afghanistan") + program = ProgramFactory(business_area=ba) + + grievance = GrievanceTicketFactory( + category=GrievanceTicket.CATEGORY_NEEDS_ADJUDICATION, + business_area=ba, + status=GrievanceTicket.STATUS_FOR_APPROVAL, + description="GrievanceTicket", + ) + grievance.programs.add(program) + ind_data = { + "given_name": "John", + "family_name": "Doe", + "middle_name": "", + "full_name": "John Doe", + } + ind_1 = IndividualFactory(household=None, program=program, **ind_data) + document = DocumentFactory(individual=ind_1, status=Document.STATUS_INVALID) + _, individuals_2 = create_household( + {"size": 1, "business_area": ba, "program": program}, + ind_data, + ) + ind_2 = individuals_2[0] + + ticket_details = TicketNeedsAdjudicationDetailsFactory( + ticket=grievance, + golden_records_individual=ind_1, + is_multiple_duplicates_version=True, + selected_individual=None, + ) + ticket_details.selected_distinct.set([ind_1, ind_2]) + ticket_details.ticket = grievance + ticket_details.save() + + close_needs_adjudication_ticket_service(grievance, user) + + ind_1.refresh_from_db() + ind_2.refresh_from_db() + document.refresh_from_db() + + self.assertEqual(ind_1.duplicate, False) + self.assertEqual(ind_2.duplicate, False) + self.assertEqual(document.status, Document.STATUS_VALID) + def test_close_needs_adjudication_ticket_service_when_just_duplicates(self) -> None: user = UserFactory() ba = BusinessAreaFactory(slug="afghanistan") From 6a8e2aa8b46214a8c884290095a3e7d12de95b0c Mon Sep 17 00:00:00 2001 From: Paulina Kujawa Date: Tue, 29 Oct 2024 12:06:33 +0100 Subject: [PATCH 2/4] fix test --- tests/unit/apps/grievance/test_services_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/apps/grievance/test_services_utils.py b/tests/unit/apps/grievance/test_services_utils.py index b884ada573..6c6a9ad171 100644 --- a/tests/unit/apps/grievance/test_services_utils.py +++ b/tests/unit/apps/grievance/test_services_utils.py @@ -418,6 +418,7 @@ def test_close_needs_adjudication_ticket_service_individual_without_household(se business_area=ba, status=GrievanceTicket.STATUS_FOR_APPROVAL, description="GrievanceTicket", + issue_type=GrievanceTicket.ISSUE_TYPE_UNIQUE_IDENTIFIERS_SIMILARITY, ) grievance.programs.add(program) ind_data = { From 9cab4e106c49312b362e5626d94c88a83e7747af Mon Sep 17 00:00:00 2001 From: Maciej Szewczyk <34482854+mmaciekk@users.noreply.github.com> Date: Tue, 29 Oct 2024 16:16:58 +0100 Subject: [PATCH 3/4] Payment Plan- Supporting documents fix (#4373) * This is an empty commit * be changes * draft commit * upd * fix download documents * remove console log * fix pdu * format * fix test_periodic_data_update_template_views * fix filename * use mimetypes.guess_type() * fix test:dart: --------- Co-authored-by: Maciej Szewczyk Co-authored-by: pavlo-mk --- src/frontend/src/api/api.ts | 16 +++++++++- src/frontend/src/api/paymentModuleApi.ts | 16 +++++++--- src/frontend/src/api/periodicDataUpdateApi.ts | 2 ++ .../SupportingDocumentsSection.tsx | 11 +++++-- .../SupportingDocumentsSectionActions.ts | 8 ++--- ...riodicDataUpdatesTemplateDetailsDialog.tsx | 2 +- ...eriodicDataUpdatesTemplatesListActions.tsx | 9 ------ .../apps/payment/api/serializers.py | 12 ++++++- src/hct_mis_api/apps/payment/api/views.py | 18 ++++------- .../apps/periodic_data_update/api/views.py | 10 ++++-- .../test_payment_plan_supporting_documents.py | 32 +++++++++++++++---- ...est_periodic_data_update_template_views.py | 7 ++-- 12 files changed, 99 insertions(+), 44 deletions(-) diff --git a/src/frontend/src/api/api.ts b/src/frontend/src/api/api.ts index 6c8dd4b789..6b5aac9c9b 100644 --- a/src/frontend/src/api/api.ts +++ b/src/frontend/src/api/api.ts @@ -19,7 +19,7 @@ export const api = { return params.toString(); }, - async get(url: string, params: Record = {}) { + async get(url: string, params: Record = {}, filename?: string) { const query = this.buildParams(params); const cacheKey = url + (query ? `?${query}` : ''); @@ -42,6 +42,20 @@ export const api = { throw new Error(`Error fetching data from ${url}`); } + // Handle download if URL includes "download" + if (url.includes('download')) { + const blob = await response.blob(); + const downloadUrl = window.URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = downloadUrl; + a.download = filename || url.split('/').pop() || 'download'; + document.body.appendChild(a); + a.click(); + a.remove(); + window.URL.revokeObjectURL(downloadUrl); + return; + } + const etag = response.headers.get('ETag'); const data = await response.json(); diff --git a/src/frontend/src/api/paymentModuleApi.ts b/src/frontend/src/api/paymentModuleApi.ts index 4dd3166d31..2beeae38dd 100644 --- a/src/frontend/src/api/paymentModuleApi.ts +++ b/src/frontend/src/api/paymentModuleApi.ts @@ -91,9 +91,17 @@ export const fetchSupportingDocument = async ( programId: string, paymentPlanId: string, fileId: string, + fileName: string, ): Promise => { - const response = await api.get( - `${businessAreaSlug}/programs/${programId}/payment-plans/${paymentPlanId}/supporting-documents/${fileId}/download/`, - ); - return response; + try { + const response = await api.get( + `${businessAreaSlug}/programs/${programId}/payment-plans/${paymentPlanId}/supporting-documents/${fileId}/download/`, + {}, + fileName, + ); + return response; + } catch (error: any) { + const errorMessage = error?.message || 'An unknown error occurred'; + throw new Error(`Failed to fetch supporting document: ${errorMessage}`); + } }; diff --git a/src/frontend/src/api/periodicDataUpdateApi.ts b/src/frontend/src/api/periodicDataUpdateApi.ts index 0048553b7e..c64a73c7f8 100644 --- a/src/frontend/src/api/periodicDataUpdateApi.ts +++ b/src/frontend/src/api/periodicDataUpdateApi.ts @@ -59,6 +59,8 @@ export const fetchPeriodicDataUpdateTemplate = async ( ): Promise => { const response = await api.get( `${businessAreaSlug}/programs/${programId}/periodic-data-update/periodic-data-update-templates/${templateId}/download/`, + {}, + `Periodic_Data_Update_Template_${templateId}`, ); return response; }; diff --git a/src/frontend/src/components/paymentmodule/PaymentPlanDetails/SupportingDocumentsSection/SupportingDocumentsSection.tsx b/src/frontend/src/components/paymentmodule/PaymentPlanDetails/SupportingDocumentsSection/SupportingDocumentsSection.tsx index a13067c0c8..a8cf784a1f 100644 --- a/src/frontend/src/components/paymentmodule/PaymentPlanDetails/SupportingDocumentsSection/SupportingDocumentsSection.tsx +++ b/src/frontend/src/components/paymentmodule/PaymentPlanDetails/SupportingDocumentsSection/SupportingDocumentsSection.tsx @@ -198,12 +198,16 @@ export const SupportingDocumentsSection = ({ 'Are you sure you want to delete this file? This action cannot be reversed.', ); - const handleSupportingDocumentDownloadClick = (fileId: string) => { + const handleSupportingDocumentDownloadClick = ( + fileId: string, + fileName: string, + ) => { downloadSupportingDocument({ businessAreaSlug: businessArea, programId, paymentPlanId: paymentPlan.id, fileId: fileId.toString(), + fileName: fileName, }); }; @@ -273,7 +277,10 @@ export const SupportingDocumentsSection = ({ {canDownloadFile && ( - handleSupportingDocumentDownloadClick(doc.id) + handleSupportingDocumentDownloadClick( + doc.id, + doc.file, + ) } data-cy="download-button" > diff --git a/src/frontend/src/components/paymentmodule/PaymentPlanDetails/SupportingDocumentsSection/SupportingDocumentsSectionActions.ts b/src/frontend/src/components/paymentmodule/PaymentPlanDetails/SupportingDocumentsSection/SupportingDocumentsSectionActions.ts index 7ace3e3b1c..69a16fe6de 100644 --- a/src/frontend/src/components/paymentmodule/PaymentPlanDetails/SupportingDocumentsSection/SupportingDocumentsSectionActions.ts +++ b/src/frontend/src/components/paymentmodule/PaymentPlanDetails/SupportingDocumentsSection/SupportingDocumentsSectionActions.ts @@ -8,23 +8,21 @@ export const useDownloadSupportingDocument = () => { programId: mutationProgramId, paymentPlanId: mutationPaymentPlanId, fileId: mutationFileId, + fileName: mutationFileName, }: { businessAreaSlug: string; programId: string; paymentPlanId: string; fileId: string; + fileName: string; }) => { return fetchSupportingDocument( mutationBusinessAreaSlug, mutationProgramId, mutationPaymentPlanId, mutationFileId, + mutationFileName, ); }, - onSuccess: (data) => { - if (data.url) { - window.open(data.url); - } - }, }); }; diff --git a/src/frontend/src/components/periodicDataUpdates/PeriodicDataUpdatesTemplateDetailsDialog.tsx b/src/frontend/src/components/periodicDataUpdates/PeriodicDataUpdatesTemplateDetailsDialog.tsx index ffab595405..cb345c64eb 100644 --- a/src/frontend/src/components/periodicDataUpdates/PeriodicDataUpdatesTemplateDetailsDialog.tsx +++ b/src/frontend/src/components/periodicDataUpdates/PeriodicDataUpdatesTemplateDetailsDialog.tsx @@ -20,7 +20,7 @@ import { } from '@mui/material'; import { PeriodicDataUpdateTemplateList } from '@restgenerated/models/PeriodicDataUpdateTemplateList'; import { useQuery } from '@tanstack/react-query'; -import React, { FC } from 'react'; +import { FC } from 'react'; import { useTranslation } from 'react-i18next'; interface PeriodicDataUpdatesTemplateDetailsDialogProps { diff --git a/src/frontend/src/components/periodicDataUpdates/PeriodicDataUpdatesTemplatesListActions.tsx b/src/frontend/src/components/periodicDataUpdates/PeriodicDataUpdatesTemplatesListActions.tsx index 57b485a309..67c57ccddc 100644 --- a/src/frontend/src/components/periodicDataUpdates/PeriodicDataUpdatesTemplatesListActions.tsx +++ b/src/frontend/src/components/periodicDataUpdates/PeriodicDataUpdatesTemplatesListActions.tsx @@ -6,7 +6,6 @@ import { import { useMutation, useQueryClient } from '@tanstack/react-query'; export const useDownloadPeriodicDataUpdateTemplate = () => { - const queryClient = useQueryClient(); return useMutation({ mutationFn: ({ businessAreaSlug: mutationBusinessAreaSlug, @@ -23,14 +22,6 @@ export const useDownloadPeriodicDataUpdateTemplate = () => { mutationTemplateId, ); }, - onSuccess: (data) => { - if (data.url) { - window.open(data.url); - } - queryClient.invalidateQueries({ - queryKey: ['periodicDataUpdateTemplates'], - }); - }, }); }; diff --git a/src/hct_mis_api/apps/payment/api/serializers.py b/src/hct_mis_api/apps/payment/api/serializers.py index e3fb5bb536..57aa929915 100644 --- a/src/hct_mis_api/apps/payment/api/serializers.py +++ b/src/hct_mis_api/apps/payment/api/serializers.py @@ -1,9 +1,12 @@ import base64 from typing import Any, Dict, Optional +from django.shortcuts import get_object_or_404 + from rest_framework import serializers from hct_mis_api.apps.account.api.fields import Base64ModelField +from hct_mis_api.apps.core.utils import decode_id_string from hct_mis_api.apps.payment.models import PaymentPlan, PaymentPlanSupportingDocument @@ -61,6 +64,7 @@ class PaymentPlanBulkActionSerializer(serializers.Serializer): class PaymentPlanSupportingDocumentSerializer(serializers.ModelSerializer): id = serializers.SerializerMethodField() + file = serializers.FileField(use_url=False) class Meta: model = PaymentPlanSupportingDocument @@ -81,7 +85,10 @@ def validate_file(self, file: Any) -> Any: return file def validate(self, data: Dict) -> Dict: - payment_plan = self.context["payment_plan"] + payment_plan_id = self.context["request"].parser_context["kwargs"]["payment_plan_id"] + payment_plan = get_object_or_404(PaymentPlan, id=decode_id_string(payment_plan_id)) + data["payment_plan"] = payment_plan + data["created_by"] = self.context["request"].user if payment_plan.status not in [PaymentPlan.Status.OPEN, PaymentPlan.Status.LOCKED]: raise serializers.ValidationError("Payment plan must be within status OPEN or LOCKED.") @@ -90,3 +97,6 @@ def validate(self, data: Dict) -> Dict: f"Payment plan already has the maximum of {PaymentPlanSupportingDocument.FILE_LIMIT} supporting documents." ) return data + + def create(self, validated_data: Dict[str, Any]) -> PaymentPlanSupportingDocument: + return super().create(validated_data) diff --git a/src/hct_mis_api/apps/payment/api/views.py b/src/hct_mis_api/apps/payment/api/views.py index 72efbf72dd..2f610c8b82 100644 --- a/src/hct_mis_api/apps/payment/api/views.py +++ b/src/hct_mis_api/apps/payment/api/views.py @@ -1,8 +1,10 @@ import logging +import mimetypes from typing import Any, Optional from django.db import transaction from django.db.models import QuerySet +from django.http import FileResponse from constance import config from django_filters import rest_framework as filters @@ -199,15 +201,6 @@ def get_object(self) -> PaymentPlanSupportingDocument: PaymentPlanSupportingDocument, id=decode_id_string(self.kwargs.get("file_id")), payment_plan=payment_plan ) - def create(self, request: Request, *args: Any, **kwargs: Any) -> Response: - payment_plan = get_object_or_404(PaymentPlan, id=decode_id_string(kwargs.get("payment_plan_id"))) - request.data["created_by"] = request.user.pk - serializer = self.get_serializer(data=request.data, context={"payment_plan": payment_plan}) - if serializer.is_valid(): - serializer.save(payment_plan=payment_plan) - return Response(serializer.data, status=status.HTTP_201_CREATED) - return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) - def destroy(self, request: Request, *args: Any, **kwargs: Any) -> Response: self.permission_classes = [PaymentPlanSupportingDocumentDeletePermission] document = self.get_object() @@ -215,6 +208,9 @@ def destroy(self, request: Request, *args: Any, **kwargs: Any) -> Response: return Response(status=status.HTTP_204_NO_CONTENT) @action(detail=True, methods=["get"]) - def download(self, request: Request, *args: Any, **kwargs: Any) -> Response: + def download(self, request: Request, *args: Any, **kwargs: Any) -> FileResponse: document = self.get_object() - return Response({"url": document.file.url}, status=status.HTTP_200_OK) + file_mimetype, _ = mimetypes.guess_type(document.file.path) + response = FileResponse(document.file.open(), content_type=file_mimetype or "application/octet-stream") + response["Content-Disposition"] = f"attachment; filename={document.file.name.split('/')[-1]}" + return response diff --git a/src/hct_mis_api/apps/periodic_data_update/api/views.py b/src/hct_mis_api/apps/periodic_data_update/api/views.py index fbfabb7fa6..13b426ebd2 100644 --- a/src/hct_mis_api/apps/periodic_data_update/api/views.py +++ b/src/hct_mis_api/apps/periodic_data_update/api/views.py @@ -3,6 +3,7 @@ from django.core.exceptions import ValidationError as DjangoValidationError from django.db.models import QuerySet +from django.http import FileResponse from constance import config from django_filters.rest_framework import DjangoFilterBackend @@ -104,7 +105,7 @@ def export(self, request: Request, *args: Any, **kwargs: Any) -> Response: return Response(status=status.HTTP_200_OK, data={"message": "Exporting template"}) @action(detail=True, methods=["get"]) - def download(self, request: Request, *args: Any, **kwargs: Any) -> Response: + def download(self, request: Request, *args: Any, **kwargs: Any) -> FileResponse: pdu_template = self.get_object() if pdu_template.status != PeriodicDataUpdateTemplate.Status.EXPORTED: @@ -115,7 +116,12 @@ def download(self, request: Request, *args: Any, **kwargs: Any) -> Response: logger.error(f"XLSX File not found. PeriodicDataUpdateTemplate ID: {pdu_template.id}") raise ValidationError("Template file is missing") - return Response({"url": pdu_template.file.file.url}, status=status.HTTP_200_OK) + return FileResponse( + pdu_template.file.file.open(), + as_attachment=True, + filename=pdu_template.file.file.name, + content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + ) class PeriodicDataUpdateUploadViewSet( diff --git a/tests/unit/apps/payment/test_payment_plan_supporting_documents.py b/tests/unit/apps/payment/test_payment_plan_supporting_documents.py index 1ac9c08ce0..b78e003c69 100644 --- a/tests/unit/apps/payment/test_payment_plan_supporting_documents.py +++ b/tests/unit/apps/payment/test_payment_plan_supporting_documents.py @@ -1,13 +1,14 @@ import base64 from io import BytesIO +from django.core.files.storage import default_storage from django.core.files.uploadedfile import InMemoryUploadedFile, SimpleUploadedFile +from django.http import FileResponse from django.test import TestCase from django.urls import reverse from rest_framework import status -from rest_framework.response import Response -from rest_framework.test import APIClient +from rest_framework.test import APIClient, APIRequestFactory from hct_mis_api.apps.account.fixtures import UserFactory from hct_mis_api.apps.account.models import Role, UserRole @@ -26,7 +27,15 @@ def setUp(cls) -> None: cls.payment_plan = PaymentPlanFactory( status=PaymentPlan.Status.OPEN, ) - cls.context = {"payment_plan": cls.payment_plan} + factory = APIRequestFactory() + cls.request = factory.post("/just_any_url/") + cls.request.user = cls.client # type: ignore + cls.request.parser_context = { + "kwargs": { + "payment_plan_id": base64.b64encode(f"PaymentPlanNode:{str(cls.payment_plan.id)}".encode()).decode(), + } + } + cls.context = {"payment_plan": cls.payment_plan, "request": cls.request} cls.file = SimpleUploadedFile("test.pdf", b"123", content_type="application/pdf") def test_validate_file_size_success(self) -> None: @@ -118,7 +127,13 @@ def setUp(cls) -> None: "payment_plan_id": payment_plan_id_base64, }, ) - cls.file = SimpleUploadedFile("test.pdf", b"abc", content_type="application/pdf") + cls.file = SimpleUploadedFile("test_file.pdf", b"abc", content_type="application/pdf") + + def tearDown(self) -> None: + for document in PaymentPlanSupportingDocument.objects.all(): + if default_storage.exists(document.file.name): + default_storage.delete(document.file.name) + PaymentPlanSupportingDocument.objects.all().delete() def test_post_successful_upload(self) -> None: self.client.force_authenticate(user=self.user) @@ -127,8 +142,12 @@ def test_post_successful_upload(self) -> None: response = self.client.post(self.url, data, format="multipart") self.assertEqual(response.status_code, status.HTTP_201_CREATED) - self.assertIn("id", response.data) self.assertEqual(PaymentPlanSupportingDocument.objects.count(), 1) + self.assertIn("id", response.data) + self.assertIn("uploaded_at", response.data) + self.assertEqual(response.data["file"], "test_file.pdf") + self.assertEqual(response.data["title"], "Test Document") + self.assertEqual(response.data["created_by"], self.user.pk) def test_post_invalid_upload(self) -> None: self.client.force_authenticate(user=self.user) @@ -196,4 +215,5 @@ def test_get_document_success(self) -> None: response = self.client.get(url) self.assertEqual(response.status_code, status.HTTP_200_OK) - self.assertIsInstance(response, Response) + self.assertIsInstance(response, FileResponse) + self.assertEqual(response["Content-Disposition"], f"attachment; filename={self.document.file.name}") diff --git a/tests/unit/apps/periodic_data_update/test_periodic_data_update_template_views.py b/tests/unit/apps/periodic_data_update/test_periodic_data_update_template_views.py index 4442243b2c..101662e465 100644 --- a/tests/unit/apps/periodic_data_update/test_periodic_data_update_template_views.py +++ b/tests/unit/apps/periodic_data_update/test_periodic_data_update_template_views.py @@ -5,6 +5,7 @@ from django.core.cache import cache from django.core.files.base import ContentFile from django.db import connection +from django.http import FileResponse from django.test.utils import CaptureQueriesContext from django.utils import timezone @@ -722,8 +723,10 @@ def test_download_periodic_data_update_template( self.pdu_template1.refresh_from_db() assert self.pdu_template1.status == PeriodicDataUpdateTemplate.Status.EXPORTED - response_json = response.json() - assert response_json == {"url": file.file.url} + assert isinstance(response, FileResponse) is True + assert f'filename="{file.file.name}"' in response["Content-Disposition"] + assert response["Content-Type"] == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + assert response.getvalue() == b"Test content" def test_download_periodic_data_update_template_not_exported( self, From a08563b28a3151578dee1f043efb4af7bfbc4096 Mon Sep 17 00:00:00 2001 From: szymon-kellton <130459593+szymon-kellton@users.noreply.github.com> Date: Wed, 30 Oct 2024 11:22:43 +0100 Subject: [PATCH 4/4] =?UTF-8?q?Fix=20test=5Fgrievance=5Ftickets=5Fcreate?= =?UTF-8?q?=5Fnew=5Fticket=5FData=5FChange=5FAdd=5FIndividu=E2=80=A6=20(#4?= =?UTF-8?q?381)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix test_grievance_tickets_create_new_ticket_Data_Change_Add_Individual_Mandatory_Fields --- .../grievance/grievance_tickets/test_grievance_tickets.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/selenium/grievance/grievance_tickets/test_grievance_tickets.py b/tests/selenium/grievance/grievance_tickets/test_grievance_tickets.py index a68d27e858..2a16aefd6d 100644 --- a/tests/selenium/grievance/grievance_tickets/test_grievance_tickets.py +++ b/tests/selenium/grievance/grievance_tickets/test_grievance_tickets.py @@ -762,15 +762,12 @@ def test_grievance_tickets_create_new_ticket_Data_Change_Add_Individual_Mandator assert "-" in pageGrievanceDetailsPage.getTicketAssigment().text assert "Data Change" in pageGrievanceDetailsPage.getTicketCategory().text assert "Add Individual" in pageGrievanceDetailsPage.getLabelIssueType().text - assert household_without_disabilities.unicef_id in pageGrievanceDetailsPage.getTicketHouseholdID().text + assert household_without_disabilities.unicef_id in pageGrievanceDetailsPage.getTicketTargetID().text assert "Test Program" in pageGrievanceDetailsPage.getLabelProgramme().text assert datetime.now().strftime("%-d %b %Y") in pageGrievanceDetailsPage.getLabelDateCreation().text assert datetime.now().strftime("%-d %b %Y") in pageGrievanceDetailsPage.getLabelLastModifiedDate().text - assert "-" in pageGrievanceDetailsPage.getLabelAdministrativeLevel2().text - assert "-" in pageGrievanceDetailsPage.getLabelLanguagesSpoken().text assert "-" in pageGrievanceDetailsPage.getLabelDocumentation().text assert "Add Individual - TEST" in pageGrievanceDetailsPage.getLabelDescription().text - assert "-" in pageGrievanceDetailsPage.getLabelComments().text assert "Male" in pageGrievanceDetailsPage.getLabelGender().text assert "Alternate collector" in pageGrievanceDetailsPage.getLabelRole().text assert "Krido" in pageGrievanceDetailsPage.getLabelFullName().text