Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sainak committed Nov 23, 2023
1 parent 763970a commit d6f0aa8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion care/facility/api/serializers/patient.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,6 @@ def save(self, **kwargs):
class PatientNotesSerializer(serializers.ModelSerializer):
facility = FacilityBasicInfoSerializer(read_only=True)
created_by_object = UserBaseMinimumSerializer(source="created_by", read_only=True)
created_by_local_user = serializers.BooleanField(read_only=True)
consultation = ExternalIdSerializerField(
queryset=PatientConsultation.objects.all(),
required=False,
Expand Down
8 changes: 8 additions & 0 deletions care/facility/tests/test_patient_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ def setUpTestData(cls) -> None:
"doctor2", cls.district, home_facility=cls.facility2, user_type=15
)
cls.patient = cls.create_patient(cls.district, cls.facility)
cls.consultation = cls.create_consultation(
patient_no="IP5678",
patient=cls.patient,
facility=cls.facility,
created_by=cls.user,
suggestion="A",
admission_date=now(),
)

def setUp(self):
super().setUp()
Expand Down
5 changes: 4 additions & 1 deletion care/utils/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,10 @@ def create_consultation(
}
)
data.update(kwargs)
return PatientConsultation.objects.create(**data)
consultation = PatientConsultation.objects.create(**data)
patient.last_consultation = consultation
patient.save()
return consultation

@classmethod
def create_asset_location(cls, facility: Facility, **kwargs) -> AssetLocation:
Expand Down

0 comments on commit d6f0aa8

Please sign in to comment.