mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-11 10:55:09 +00:00
refactor(test): move location creation to bootstrap in asset movement
This commit is contained in:
@@ -15,7 +15,6 @@ class TestAssetMovement(ERPNextTestSuite):
|
||||
frappe.db.set_value(
|
||||
"Company", "_Test Company", "capital_work_in_progress_account", "CWIP Account - _TC"
|
||||
)
|
||||
make_location()
|
||||
|
||||
def test_movement(self):
|
||||
pr = make_purchase_receipt(item_code="Macbook Pro", qty=1, rate=100000.0, location="Test Location")
|
||||
@@ -39,10 +38,6 @@ class TestAssetMovement(ERPNextTestSuite):
|
||||
if asset.docstatus == 0:
|
||||
asset.submit()
|
||||
|
||||
# check asset movement is created
|
||||
if not frappe.db.exists("Location", "Test Location 2"):
|
||||
frappe.get_doc({"doctype": "Location", "location_name": "Test Location 2"}).insert()
|
||||
|
||||
create_asset_movement(
|
||||
purpose="Transfer",
|
||||
company=asset.company,
|
||||
@@ -121,9 +116,6 @@ class TestAssetMovement(ERPNextTestSuite):
|
||||
if asset.docstatus == 0:
|
||||
asset.submit()
|
||||
|
||||
if not frappe.db.exists("Location", "Test Location 2"):
|
||||
frappe.get_doc({"doctype": "Location", "location_name": "Test Location 2"}).insert()
|
||||
|
||||
movement = frappe.get_doc({"doctype": "Asset Movement", "reference_name": pr.name})
|
||||
self.assertRaises(frappe.ValidationError, movement.cancel)
|
||||
|
||||
@@ -149,9 +141,6 @@ class TestAssetMovement(ERPNextTestSuite):
|
||||
asset = create_asset(item_code="Macbook Pro", do_not_save=1)
|
||||
asset.save().submit()
|
||||
|
||||
if not frappe.db.exists("Location", "Test Location 2"):
|
||||
frappe.get_doc({"doctype": "Location", "location_name": "Test Location 2"}).insert()
|
||||
|
||||
asset_creation_date = frappe.db.get_value(
|
||||
"Asset Movement",
|
||||
[["Asset Movement Item", "asset", "=", asset.name], ["docstatus", "=", 1]],
|
||||
@@ -196,9 +185,3 @@ def create_asset_movement(**args):
|
||||
movement.submit()
|
||||
|
||||
return movement
|
||||
|
||||
|
||||
def make_location():
|
||||
for location in ["Pune", "Mumbai", "Nagpur"]:
|
||||
if not frappe.db.exists("Location", location):
|
||||
frappe.get_doc({"doctype": "Location", "location_name": location}).insert(ignore_permissions=True)
|
||||
|
||||
@@ -975,6 +975,7 @@ class BootStrapTestData:
|
||||
def make_location(self):
|
||||
records = [
|
||||
{"doctype": "Location", "location_name": "Test Location"},
|
||||
{"doctype": "Location", "location_name": "Test Location 2"},
|
||||
{"doctype": "Location", "location_name": "Test Location Area", "is_group": 1, "is_container": 1},
|
||||
{
|
||||
"doctype": "Location",
|
||||
|
||||
Reference in New Issue
Block a user