Skip to content

Commit

Permalink
fix: use db.set_single_value on single doctype
Browse files Browse the repository at this point in the history
(cherry picked from commit 9ab8a6f)
  • Loading branch information
akurungadam authored and Sajinsr committed Dec 17, 2024
1 parent 5f15057 commit c495637
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions healthcare/healthcare/doctype/lab_test/test_lab_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ def test_descriptive_lab_test(self):
self.assertRaises(frappe.ValidationError, lab_test.submit)

def test_sample_collection(self):
frappe.db.set_value(
"Healthcare Settings", "Healthcare Settings", "create_sample_collection_for_lab_test", 1
)
frappe.db.set_single_value("Healthcare Settings", "create_sample_collection_for_lab_test", 1)
lab_template = create_lab_test_template()

lab_test = create_lab_test(lab_template)
Expand All @@ -63,9 +61,7 @@ def test_sample_collection(self):
# check sample collection created
self.assertTrue(frappe.db.exists("Sample Collection", {"sample": lab_template.sample}))

frappe.db.set_value(
"Healthcare Settings", "Healthcare Settings", "create_sample_collection_for_lab_test", 0
)
frappe.db.set_single_value("Healthcare Settings", "create_sample_collection_for_lab_test", 0)
lab_test = create_lab_test(lab_template)
lab_test.descriptive_test_items[0].result_value = 12
lab_test.descriptive_test_items[1].result_value = 1
Expand Down
2 changes: 1 addition & 1 deletion healthcare/healthcare/doctype/patient/test_patient.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class TestPatient(FrappeTestCase):
def test_customer_created(self):
frappe.db.sql("""delete from `tabPatient`""")
frappe.db.set_value("Healthcare Settings", None, "link_customer_to_patient", 1)
frappe.db.set_single_value("Healthcare Settings", "link_customer_to_patient", 1)
patient = create_patient()
self.assertTrue(frappe.db.get_value("Patient", patient, "customer"))

Expand Down

0 comments on commit c495637

Please sign in to comment.