Merge branch 'wsgi' of github.com:webnotes/erpnext into wsgi

This commit is contained in:
Nabin Hait
2013-10-16 11:19:09 +05:30
19 changed files with 172 additions and 54 deletions

View File

@@ -17,6 +17,8 @@ class TestCustomer(unittest.TestCase):
(("_Test Customer 1 Renamed",),))
self.assertEqual(webnotes.conn.exists("Customer", "_Test Customer 1"), ())
webnotes.rename_doc("Customer", "_Test Customer 1 Renamed", "_Test Customer 1")
def test_merge(self):
from webnotes.test_runner import make_test_records
make_test_records("Sales Invoice")
@@ -57,6 +59,9 @@ class TestCustomer(unittest.TestCase):
# check that old name doesn't exist
self.assertEqual(webnotes.conn.exists("Customer", "_Test Customer"), ())
self.assertEqual(webnotes.conn.exists("Account", "_Test Customer - _TC"), ())
# create back _Test Customer
webnotes.bean(copy=test_records[0]).insert()
test_ignore = ["Price List"]

View File

@@ -11,17 +11,19 @@ class TestQuotation(unittest.TestCase):
def test_make_sales_order(self):
from selling.doctype.quotation.quotation import make_sales_order
self.assertRaises(webnotes.ValidationError, make_sales_order, "_T-Quotation-00001")
quotation = webnotes.bean(copy=test_records[0])
quotation.insert()
self.assertRaises(webnotes.ValidationError, make_sales_order, quotation.doc.name)
quotation = webnotes.bean("Quotation","_T-Quotation-00001")
quotation.submit()
sales_order = make_sales_order("_T-Quotation-00001")
sales_order = make_sales_order(quotation.doc.name)
self.assertEquals(sales_order[0]["doctype"], "Sales Order")
self.assertEquals(len(sales_order), 2)
self.assertEquals(sales_order[1]["doctype"], "Sales Order Item")
self.assertEquals(sales_order[1]["prevdoc_docname"], "_T-Quotation-00001")
self.assertEquals(sales_order[1]["prevdoc_docname"], quotation.doc.name)
self.assertEquals(sales_order[0]["customer"], "_Test Customer")
sales_order[0]["delivery_date"] = "2014-01-01"

View File

@@ -72,6 +72,10 @@ class TestSalesOrder(unittest.TestCase):
def create_dn_against_so(self, so, delivered_qty=0):
from stock.doctype.delivery_note.test_delivery_note import test_records as dn_test_records
from stock.doctype.delivery_note.test_delivery_note import _insert_purchase_receipt
_insert_purchase_receipt(so.doclist[1].item_code)
dn = webnotes.bean(webnotes.copy_doclist(dn_test_records[0]))
dn.doclist[1].item_code = so.doclist[1].item_code
dn.doclist[1].against_sales_order = so.doc.name
@@ -272,14 +276,13 @@ class TestSalesOrder(unittest.TestCase):
so.doclist[1].reserved_warehouse, 20.0)
def test_warehouse_user(self):
webnotes.session.user = "test@example.com"
webnotes.bean("Profile", "test@example.com").get_controller()\
.add_roles("Sales User", "Sales Manager", "Material User", "Material Manager")
webnotes.bean("Profile", "test2@example.com").get_controller()\
.add_roles("Sales User", "Sales Manager", "Material User", "Material Manager")
webnotes.session.user = "test@example.com"
from stock.utils import UserNotAllowedForWarehouse
so = webnotes.bean(copy = test_records[0])