fix: failing tests
This commit is contained in:
parent
8844e95667
commit
d30023abac
@ -6,10 +6,6 @@ import unittest
|
||||
import frappe
|
||||
|
||||
class TestHealthcareServiceUnitType(unittest.TestCase):
|
||||
def setUp(self):
|
||||
frappe.db.sql("""delete from `tabHealthcare Service Unit Type`""")
|
||||
frappe.db.sql("""delete from `tabItem`""")
|
||||
|
||||
def test_item_creation(self):
|
||||
unit_type = get_unit_type()
|
||||
self.assertTrue(frappe.db.exists('Item', unit_type.item))
|
||||
|
@ -8,11 +8,12 @@ import unittest
|
||||
from frappe.utils import now_datetime, today
|
||||
from frappe.utils.make_random import get_random
|
||||
from erpnext.healthcare.doctype.inpatient_record.inpatient_record import admit_patient, discharge_patient, schedule_discharge
|
||||
from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_patient
|
||||
|
||||
class TestInpatientRecord(unittest.TestCase):
|
||||
def test_admit_and_discharge(self):
|
||||
frappe.db.sql("""delete from `tabInpatient Record`""")
|
||||
patient = get_patient()
|
||||
patient = create_patient()
|
||||
# Schedule Admission
|
||||
ip_record = create_inpatient(patient)
|
||||
ip_record.save(ignore_permissions = True)
|
||||
@ -41,7 +42,7 @@ class TestInpatientRecord(unittest.TestCase):
|
||||
|
||||
def test_validate_overlap_admission(self):
|
||||
frappe.db.sql("""delete from `tabInpatient Record`""")
|
||||
patient = get_patient()
|
||||
patient = create_patient()
|
||||
|
||||
ip_record = create_inpatient(patient)
|
||||
ip_record.save(ignore_permissions = True)
|
||||
@ -75,18 +76,6 @@ def create_inpatient(patient):
|
||||
inpatient_record.scheduled_date = today()
|
||||
return inpatient_record
|
||||
|
||||
def get_patient():
|
||||
patient = get_random("Patient")
|
||||
if not patient:
|
||||
patient = frappe.new_doc("Patient")
|
||||
patient.first_name = "_Test Patient"
|
||||
patient.sex = "Male"
|
||||
patient.mobile = 9876345675
|
||||
patient.save(ignore_permissions=True)
|
||||
return patient.name
|
||||
return patient
|
||||
|
||||
|
||||
def get_healthcare_service_unit():
|
||||
service_unit = get_random("Healthcare Service Unit", filters={"inpatient_occupancy": 1})
|
||||
if not service_unit:
|
||||
|
@ -5,13 +5,13 @@ from __future__ import unicode_literals
|
||||
|
||||
import unittest
|
||||
import frappe
|
||||
from erpnext.healthcare.doctype.inpatient_record.test_inpatient_record import get_patient
|
||||
from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_patient
|
||||
|
||||
class TestPatient(unittest.TestCase):
|
||||
def test_customer_created(self):
|
||||
frappe.db.sql("""delete from `tabPatient`""")
|
||||
frappe.db.set_value('Healthcare Settings', None, 'link_customer_to_patient', 1)
|
||||
patient = get_patient()
|
||||
patient = create_patient()
|
||||
self.assertTrue(frappe.db.get_value('Patient', patient, 'customer'))
|
||||
|
||||
def test_patient_registration(self):
|
||||
@ -21,7 +21,7 @@ class TestPatient(unittest.TestCase):
|
||||
settings.registration_fee = 500
|
||||
settings.save()
|
||||
|
||||
patient = get_patient()
|
||||
patient = create_patient()
|
||||
patient = frappe.get_doc('Patient', patient)
|
||||
self.assertEqual(patient.status, 'Disabled')
|
||||
|
||||
|
@ -58,17 +58,10 @@ class TestPatientAppointment(unittest.TestCase):
|
||||
|
||||
|
||||
def create_healthcare_docs():
|
||||
patient = get_random('Patient')
|
||||
patient = create_patient()
|
||||
practitioner = frappe.db.exists('Healthcare Practitioner', '_Test Healthcare Practitioner')
|
||||
medical_department = frappe.db.exists('Medical Department', '_Test Medical Department')
|
||||
|
||||
if not patient:
|
||||
patient = frappe.new_doc('Patient')
|
||||
patient.first_name = '_Test Patient'
|
||||
patient.sex = 'Female'
|
||||
patient.save(ignore_permissions=True)
|
||||
patient = patient.name
|
||||
|
||||
if not medical_department:
|
||||
medical_department = frappe.new_doc('Medical Department')
|
||||
medical_department.department = '_Test Medical Department'
|
||||
@ -87,6 +80,16 @@ def create_healthcare_docs():
|
||||
|
||||
return patient, medical_department, practitioner
|
||||
|
||||
def create_patient():
|
||||
patient = frappe.db.exists('Patient', '_Test Patient')
|
||||
if not patient:
|
||||
patient = frappe.new_doc('Patient')
|
||||
patient.first_name = '_Test Patient'
|
||||
patient.sex = 'Female'
|
||||
patient.save(ignore_permissions=True)
|
||||
patient = patient.name
|
||||
return patient
|
||||
|
||||
def create_encounter(appointment=None):
|
||||
encounter = frappe.new_doc('Patient Encounter')
|
||||
if appointment:
|
||||
|
Loading…
x
Reference in New Issue
Block a user