From eee71f37d80d45a172effdada150d91c0d227f5f Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Thu, 21 Jan 2021 17:47:20 +0530 Subject: [PATCH] fix: test --- .../doctype/membership/test_membership.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/erpnext/non_profit/doctype/membership/test_membership.py b/erpnext/non_profit/doctype/membership/test_membership.py index db56527024..2d9b336f8c 100644 --- a/erpnext/non_profit/doctype/membership/test_membership.py +++ b/erpnext/non_profit/doctype/membership/test_membership.py @@ -7,7 +7,6 @@ import frappe import erpnext from erpnext.non_profit.doctype.member.member import create_member from frappe.utils import nowdate, add_months -from erpnext.stock.doctype.item.test_item import create_item class TestMembership(unittest.TestCase): def setUp(self): @@ -33,7 +32,7 @@ class TestMembership(unittest.TestCase): plan.membership_type = "_rzpy_test_milythm" plan.amount = 100 plan.razorpay_plan_id = "_rzpy_test_milythm" - plan.linked_item = create_item("_Test Item for Non Profit Membership", is_stock_item=0).name + plan.linked_item = create_item("_Test Item for Non Profit Membership").name plan.insert() # make test member @@ -92,4 +91,18 @@ def make_membership(member, payload={}): data.update(payload) membership = frappe.get_doc(data) membership.insert(ignore_permissions=True, ignore_if_duplicate=True) - return membership \ No newline at end of file + return membership + +def create_item(item_code): + if not frappe.db.exists("Item", item_code): + item = frappe.new_doc("Item") + item.item_code = item_code + item.item_name = item_code + item.stock_uom = "Nos" + item.description = item_code + item.item_group = "All Item Groups" + item.is_stock_item = 0 + item.save() + else: + item = frappe.get_doc("Item", item_code) + return item