From c495637a82cc6d79384a5f628020284216232123 Mon Sep 17 00:00:00 2001 From: Anoop Kurungadam Date: Tue, 3 Dec 2024 00:36:06 +0530 Subject: [PATCH] fix: use db.set_single_value on single doctype (cherry picked from commit 9ab8a6f1b635175dd3162c14fdd85313b2b2d21b) --- healthcare/healthcare/doctype/lab_test/test_lab_test.py | 8 ++------ healthcare/healthcare/doctype/patient/test_patient.py | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/healthcare/healthcare/doctype/lab_test/test_lab_test.py b/healthcare/healthcare/doctype/lab_test/test_lab_test.py index 878d86149a..393b5cdd2b 100644 --- a/healthcare/healthcare/doctype/lab_test/test_lab_test.py +++ b/healthcare/healthcare/doctype/lab_test/test_lab_test.py @@ -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) @@ -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 diff --git a/healthcare/healthcare/doctype/patient/test_patient.py b/healthcare/healthcare/doctype/patient/test_patient.py index 79443f25b5..21357ab4d5 100644 --- a/healthcare/healthcare/doctype/patient/test_patient.py +++ b/healthcare/healthcare/doctype/patient/test_patient.py @@ -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"))