mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-23 21:22:42 +01:00
refactor(test): make location determinisitic
This commit is contained in:
@@ -77,7 +77,7 @@ class Location(NestedSet):
|
||||
location = json.loads(self.location)
|
||||
location["features"] = features
|
||||
|
||||
self.db_set("location", json.dumps(location), commit=True)
|
||||
self.db_set("location", json.dumps(location))
|
||||
|
||||
def update_ancestor_location_features(self):
|
||||
self_features = set(self.add_child_property())
|
||||
@@ -105,7 +105,7 @@ class Location(NestedSet):
|
||||
ancestor_features[index] = json.loads(feature)
|
||||
|
||||
ancestor_doc.set_location_features(features=ancestor_features)
|
||||
ancestor_doc.db_set("area", ancestor_doc.area + self.area_difference, commit=True)
|
||||
ancestor_doc.db_set("area", ancestor_doc.area + self.area_difference)
|
||||
|
||||
def remove_ancestor_location_features(self):
|
||||
for ancestor in self.get_ancestors():
|
||||
@@ -116,7 +116,7 @@ class Location(NestedSet):
|
||||
ancestor_features[index] = json.loads(feature)
|
||||
|
||||
ancestor_doc.set_location_features(features=ancestor_features)
|
||||
ancestor_doc.db_set("area", ancestor_doc.area - self.area, commit=True)
|
||||
ancestor_doc.db_set("area", ancestor_doc.area - self.area)
|
||||
|
||||
def add_child_property(self):
|
||||
features = self.get_location_features()
|
||||
|
||||
@@ -8,7 +8,7 @@ from erpnext.tests.utils import ERPNextTestSuite
|
||||
|
||||
|
||||
class TestLocation(ERPNextTestSuite):
|
||||
def runTest(self):
|
||||
def test_location_features(self):
|
||||
locations = ["Basil Farm", "Division 1", "Field 1", "Block 1"]
|
||||
area = 0
|
||||
formatted_locations = []
|
||||
|
||||
Reference in New Issue
Block a user