Merge pull request #7200 from nabinhait/hotfix
Fixed test cases for item / warehouse renaming
This commit is contained in:
commit
c7b32e84d0
@ -174,7 +174,7 @@ class TestItem(unittest.TestCase):
|
||||
variant.item_name = "_Test Numeric Variant Large 1.5m"
|
||||
variant.save()
|
||||
|
||||
def test_item_merging(self):
|
||||
def test_item_merging(self):
|
||||
create_item("Test Item for Merging 1")
|
||||
create_item("Test Item for Merging 2")
|
||||
|
||||
@ -191,8 +191,7 @@ class TestItem(unittest.TestCase):
|
||||
{"item_code": "Test Item for Merging 2", "warehouse": "_Test Warehouse - _TC"}))
|
||||
|
||||
self.assertTrue(frappe.db.get_value("Bin",
|
||||
{"item_code": "Test Item for Merging - 2", "warehouse": "_Test Warehouse 1 - _TC"}))
|
||||
|
||||
{"item_code": "Test Item for Merging 2", "warehouse": "_Test Warehouse 1 - _TC"}))
|
||||
|
||||
def make_item_variant():
|
||||
if not frappe.db.exists("Item", "_Test Variant Item-S"):
|
||||
|
@ -4,6 +4,7 @@ from __future__ import unicode_literals
|
||||
from frappe.model.rename_doc import rename_doc
|
||||
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
|
||||
from frappe.utils import cint
|
||||
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
@ -25,6 +26,7 @@ class TestWarehouse(unittest.TestCase):
|
||||
self.assertEquals(child_warehouse.is_group, 0)
|
||||
|
||||
def test_warehouse_renaming(self):
|
||||
set_perpetual_inventory(1)
|
||||
create_warehouse("Test Warehouse for Renaming 1")
|
||||
|
||||
self.assertTrue(frappe.db.exists("Account", "Test Warehouse for Renaming 1 - _TC"))
|
||||
@ -32,6 +34,8 @@ class TestWarehouse(unittest.TestCase):
|
||||
filters={"warehouse": "Test Warehouse for Renaming 1 - _TC"}))
|
||||
|
||||
# Rename with abbr
|
||||
if frappe.db.exists("Warehouse", "Test Warehouse for Renaming 2 - _TC"):
|
||||
frappe.delete_doc("Warehouse", "Test Warehouse for Renaming 2 - _TC")
|
||||
rename_doc("Warehouse", "Test Warehouse for Renaming 1 - _TC", "Test Warehouse for Renaming 2 - _TC")
|
||||
|
||||
self.assertTrue(frappe.db.exists("Account", "Test Warehouse for Renaming 2 - _TC"))
|
||||
@ -39,13 +43,20 @@ class TestWarehouse(unittest.TestCase):
|
||||
filters={"warehouse": "Test Warehouse for Renaming 2 - _TC"}))
|
||||
|
||||
# Rename without abbr
|
||||
if frappe.db.exists("Warehouse", "Test Warehouse for Renaming 3 - _TC"):
|
||||
frappe.delete_doc("Warehouse", "Test Warehouse for Renaming 3 - _TC")
|
||||
|
||||
rename_doc("Warehouse", "Test Warehouse for Renaming 2 - _TC", "Test Warehouse for Renaming 3")
|
||||
|
||||
self.assertTrue(frappe.db.exists("Account", "Test Warehouse for Renaming 3 - _TC"))
|
||||
self.assertTrue(frappe.db.get_value("Account",
|
||||
filters={"warehouse": "Test Warehouse for Renaming 3 - _TC"}))
|
||||
|
||||
set_perpetual_inventory(0)
|
||||
|
||||
def test_warehouse_merging(self):
|
||||
set_perpetual_inventory(1)
|
||||
|
||||
create_warehouse("Test Warehouse for Merging 1")
|
||||
create_warehouse("Test Warehouse for Merging 2")
|
||||
|
||||
@ -76,7 +87,8 @@ class TestWarehouse(unittest.TestCase):
|
||||
self.assertTrue(frappe.db.get_value("Account",
|
||||
filters={"warehouse": "Test Warehouse for Merging 2 - _TC"}))
|
||||
|
||||
|
||||
set_perpetual_inventory(0)
|
||||
|
||||
def create_warehouse(warehouse_name):
|
||||
if not frappe.db.exists("Warehouse", warehouse_name + " - _TC"):
|
||||
w = frappe.new_doc("Warehouse")
|
||||
|
Loading…
x
Reference in New Issue
Block a user