seitime-frappe/frappe/tests/test_client.py
Makarand Bauskar 6fa9967a04 [hotfix] throw DoesNotExistError if doctype is not available on Delete api (#4013)
* [hotfix] throw DoesNotExistError if doctype is not available on Delete api

* [fixes] aded tests cases and codecy, travis fixes
2017-09-01 09:16:32 +05:30

23 lines
869 B
Python

# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
from __future__ import unicode_literals
import unittest, frappe
class TestClient(unittest.TestCase):
def test_set_value(self):
todo = frappe.get_doc(dict(doctype='ToDo', description='test')).insert()
frappe.set_value('ToDo', todo.name, 'description', 'test 1')
self.assertEquals(frappe.get_value('ToDo', todo.name, 'description'), 'test 1')
frappe.set_value('ToDo', todo.name, {'description': 'test 2'})
self.assertEquals(frappe.get_value('ToDo', todo.name, 'description'), 'test 2')
def test_delete(self):
from frappe.client import delete
todo = frappe.get_doc(dict(doctype='ToDo', description='description')).insert()
delete("ToDo", todo.name)
self.assertFalse(frappe.db.exists("ToDo", todo.name))
self.assertRaises(frappe.DoesNotExistError, delete, "ToDo", todo.name)