mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-13 01:34:10 +00:00
test: basic tests for controllers/queries (#27422)
(cherry picked from commit 62fc544280)
# Conflicts:
# erpnext/controllers/queries.py
# erpnext/controllers/tests/test_queries.py
This commit is contained in:
@@ -337,9 +337,14 @@ def bom(doctype, txt, searchfield, start, page_len, filters):
|
||||
@frappe.whitelist()
|
||||
@frappe.validate_and_sanitize_search_inputs
|
||||
def get_project_name(doctype, txt, searchfield, start, page_len, filters):
|
||||
<<<<<<< HEAD
|
||||
doctype = "Project"
|
||||
cond = ""
|
||||
if filters and filters.get("customer"):
|
||||
=======
|
||||
cond = ''
|
||||
if filters and filters.get('customer'):
|
||||
>>>>>>> 62fc544280 (test: basic tests for controllers/queries (#27422))
|
||||
cond = """(`tabProject`.customer = %s or
|
||||
ifnull(`tabProject`.customer,"")="") and""" % (
|
||||
frappe.db.escape(filters.get("customer"))
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import unittest
|
||||
from functools import partial
|
||||
|
||||
<<<<<<< HEAD
|
||||
import frappe
|
||||
|
||||
=======
|
||||
>>>>>>> 62fc544280 (test: basic tests for controllers/queries (#27422))
|
||||
from erpnext.controllers import queries
|
||||
|
||||
|
||||
@@ -56,12 +59,15 @@ class TestQueries(unittest.TestCase):
|
||||
bundled_stock_items = query(txt="_test product bundle item 5", filters={"is_stock_item": 1})
|
||||
self.assertEqual(len(bundled_stock_items), 0)
|
||||
|
||||
<<<<<<< HEAD
|
||||
# empty customer/supplier should be stripped of instead of failure
|
||||
query(txt="", filters={"customer": None})
|
||||
query(txt="", filters={"customer": ""})
|
||||
query(txt="", filters={"supplier": None})
|
||||
query(txt="", filters={"supplier": ""})
|
||||
|
||||
=======
|
||||
>>>>>>> 62fc544280 (test: basic tests for controllers/queries (#27422))
|
||||
def test_bom_qury(self):
|
||||
query = add_default_params(queries.bom, "BOM")
|
||||
|
||||
@@ -93,6 +99,9 @@ class TestQueries(unittest.TestCase):
|
||||
|
||||
wh = query(filters=[["Bin", "item_code", "=", "_Test Item"]])
|
||||
self.assertGreaterEqual(len(wh), 1)
|
||||
<<<<<<< HEAD
|
||||
|
||||
def test_default_uoms(self):
|
||||
self.assertGreaterEqual(frappe.db.count("UOM", {"enabled": 1}), 10)
|
||||
=======
|
||||
>>>>>>> 62fc544280 (test: basic tests for controllers/queries (#27422))
|
||||
|
||||
Reference in New Issue
Block a user