refactor(test): make location determinisitic

This commit is contained in:
ruthra kumar
2026-03-02 21:49:46 +05:30
parent 6eea0a2299
commit da8fcde4a8
2 changed files with 4 additions and 4 deletions

View File

@@ -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()

View File

@@ -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 = []