[minor] don't rollback when running all tests, fixed test cases

This commit is contained in:
Anand Doshi
2013-10-15 19:52:29 +05:30
parent 8ae6520129
commit a295bf5421
15 changed files with 160 additions and 47 deletions

View File

@@ -5,15 +5,31 @@ import webnotes, unittest
class TimeLogBatchTest(unittest.TestCase):
def test_time_log_status(self):
self.assertEquals(webnotes.conn.get_value("Time Log", "_T-Time Log-00001", "status"), "Submitted")
tlb = webnotes.bean("Time Log Batch", "_T-Time Log Batch-00001")
from projects.doctype.time_log.test_time_log import test_records as time_log_records
time_log = webnotes.bean(copy=time_log_records[0])
time_log.doc.fields.update({
"from_time": "2013-01-02 10:00:00",
"to_time": "2013-01-02 11:00:00",
"docstatus": 0
})
time_log.insert()
time_log.submit()
self.assertEquals(webnotes.conn.get_value("Time Log", time_log.doc.name, "status"), "Submitted")
tlb = webnotes.bean(copy=test_records[0])
tlb.doclist[1].time_log = time_log.doc.name
tlb.insert()
tlb.submit()
self.assertEquals(webnotes.conn.get_value("Time Log", "_T-Time Log-00001", "status"), "Batched for Billing")
self.assertEquals(webnotes.conn.get_value("Time Log", time_log.doc.name, "status"), "Batched for Billing")
tlb.cancel()
self.assertEquals(webnotes.conn.get_value("Time Log", "_T-Time Log-00001", "status"), "Submitted")
self.assertEquals(webnotes.conn.get_value("Time Log", time_log.doc.name, "status"), "Submitted")
test_records = [[
{"rate": "500"},
{
"doctype": "Time Log Batch",
"rate": "500"
},
{
"doctype": "Time Log Batch Detail",
"parenttype": "Time Log Batch",