seitime-frappe/frappe/tests/test_document_locks.py
Suraj Shetty c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30

19 lines
505 B
Python

# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import unittest
import frappe
class TestDocumentLocks(unittest.TestCase):
def test_locking(self):
todo = frappe.get_doc(dict(doctype="ToDo", description="test")).insert()
todo_1 = frappe.get_doc("ToDo", todo.name)
todo.lock()
self.assertRaises(frappe.DocumentLockedError, todo_1.lock)
todo.unlock()
todo_1.lock()
self.assertRaises(frappe.DocumentLockedError, todo.lock)
todo_1.unlock()