mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 19:29:10 +00:00
test: Healthcare Masters
This commit is contained in:
@@ -3,6 +3,35 @@
|
|||||||
# See license.txt
|
# See license.txt
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import unittest
|
import unittest
|
||||||
|
import frappe
|
||||||
|
|
||||||
class TestHealthcareServiceUnitType(unittest.TestCase):
|
class TestHealthcareServiceUnitType(unittest.TestCase):
|
||||||
pass
|
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))
|
||||||
|
|
||||||
|
# check item disabled
|
||||||
|
unit_type.disabled = 1
|
||||||
|
unit_type.save()
|
||||||
|
self.assertEqual(frappe.db.get_value('Item', unit_type.item, 'disabled'), 1)
|
||||||
|
|
||||||
|
|
||||||
|
def get_unit_type():
|
||||||
|
if frappe.db.exists('Healthcare Service Unit Type', 'Inpatient Rooms'):
|
||||||
|
return frappe.get_doc('Healthcare Service Unit Type', 'Inpatient Rooms')
|
||||||
|
|
||||||
|
unit_type = frappe.new_doc('Healthcare Service Unit Type')
|
||||||
|
unit_type.service_unit_type = 'Inpatient Rooms'
|
||||||
|
unit_type.inpatient_occupancy = 1
|
||||||
|
unit_type.is_billable = 1
|
||||||
|
unit_type.item_code = 'Inpatient Rooms'
|
||||||
|
unit_type.item_group = 'Services'
|
||||||
|
unit_type.uom = 'Hour'
|
||||||
|
unit_type.no_of_hours = 1
|
||||||
|
unit_type.rate = 4000
|
||||||
|
unit_type.save()
|
||||||
|
return unit_type
|
||||||
@@ -81,6 +81,7 @@ def get_patient():
|
|||||||
patient = frappe.new_doc("Patient")
|
patient = frappe.new_doc("Patient")
|
||||||
patient.first_name = "_Test Patient"
|
patient.first_name = "_Test Patient"
|
||||||
patient.sex = "Male"
|
patient.sex = "Male"
|
||||||
|
patient.mobile = 9876345675
|
||||||
patient.save(ignore_permissions=True)
|
patient.save(ignore_permissions=True)
|
||||||
return patient.name
|
return patient.name
|
||||||
return patient
|
return patient
|
||||||
|
|||||||
@@ -4,8 +4,31 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
import frappe
|
||||||
# test_records = frappe.get_test_records('Patient')
|
from erpnext.healthcare.doctype.inpatient_record.test_inpatient_record import get_patient
|
||||||
|
|
||||||
class TestPatient(unittest.TestCase):
|
class TestPatient(unittest.TestCase):
|
||||||
pass
|
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()
|
||||||
|
self.assertTrue(frappe.db.get_value('Patient', patient, 'customer'))
|
||||||
|
|
||||||
|
def test_patient_registration(self):
|
||||||
|
frappe.db.sql("""delete from `tabPatient`""")
|
||||||
|
settings = frappe.get_single('Healthcare Settings')
|
||||||
|
settings.collect_registration_fee = 1
|
||||||
|
settings.registration_fee = 500
|
||||||
|
settings.save()
|
||||||
|
|
||||||
|
patient = get_patient()
|
||||||
|
patient = frappe.get_doc('Patient', patient)
|
||||||
|
self.assertEqual(patient.status, 'Disabled')
|
||||||
|
|
||||||
|
# check sales invoice and patient status
|
||||||
|
result = patient.invoice_patient_registration()
|
||||||
|
self.assertTrue(frappe.db.exists('Sales Invoice', result.get('invoice')))
|
||||||
|
self.assertTrue(patient.status, 'Active')
|
||||||
|
|
||||||
|
settings.collect_registration_fee = 0
|
||||||
|
settings.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user