seitime-frappe/frappe/tests/test_document_locks.py
Rushabh Mehta 4bd2285159 File Based Locking at Document Level (#2374)
* [redesign] improved locking in documents and redesigned recent documents

* [minor] patch to update doctype in existing documents
2016-11-25 16:14:00 +05:30

18 lines
541 B
Python

# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, unittest
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()