瀏覽代碼

test: frappe.db.exists

version-14
barredterra 3 年之前
父節點
當前提交
734d0b4fe8
共有 1 個檔案被更改,包括 8 行新增0 行删除
  1. +8
    -0
      frappe/tests/test_db.py

+ 8
- 0
frappe/tests/test_db.py 查看文件

@@ -301,6 +301,14 @@ class TestDB(unittest.TestCase):
# recover transaction to continue other tests # recover transaction to continue other tests
raise Exception raise Exception


def test_exists(self):
dt, dn = "User", "Administrator"
self.assertEqual(frappe.db.exists(dt, dn, cache=True), dn)
self.assertEqual(frappe.db.exists(dt, dn), dn)
self.assertEqual(frappe.db.exists(dt, {"name": ("=", dn)}), dn)
self.assertEqual(frappe.db.exists({"doctype": dt, "name": ("like", "Admin%")}), dn)
self.assertEqual(frappe.db.exists(dt, [["name", "=", dn]]), dn)



@run_only_if(db_type_is.MARIADB) @run_only_if(db_type_is.MARIADB)
class TestDDLCommandsMaria(unittest.TestCase): class TestDDLCommandsMaria(unittest.TestCase):


Loading…
取消
儲存