-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Labels
Description
Overview
- The
test_related_filtertest is non-determinisitic
Bug
The goal note data is assigned through an iteration loop that expects property IDs to be ordered similar to their names (property1, property2, property3, property4), but sometimes those IDs can get out of order leading to the test occasionally failing.
Solution
Be more direct with the assignment of the goal note data. Assertions should be updated to expect these resolutions and historical note values.
goal_note_values = {
self.property1.id: {
"resolution": "a",
"question": "Is this value correct?",
"passed_checks": True,
"new_or_acquired": True,
},
# Property 2 is not in root_goal and will be ignored
self.property2.id: {
"resolution": "b",
"question": "Are these values correct?",
"passed_checks": False,
"new_or_acquired": False,
},
self.property3.id: {
"resolution": "c",
"question": "Other or multiple flags; explain in Additional Notes field",
"passed_checks": True,
"new_or_acquired": True,
},
self.property4.id: {
"resolution": "d",
"question": "Is this other value correct?",
"passed_checks": False,
"new_or_acquired": False,
},
}
for goal_note in self.root_cycle_goal.goal.goalnote_set.select_related("property"):
for field, value in goal_note_values[goal_note.property_id].items():
setattr(goal_note, field, value)
goal_note.save()
historical_note_values = {
self.property1.id: "x",
self.property3.id: "y",
self.property4.id: "z",
}
for historical_note in HistoricalNote.objects.filter(property__in=self.root_cycle_goal.properties()):
historical_note.text = historical_note_values.get(historical_note.property_id)
historical_note.save()
Reactions are currently unavailable