Commit 5d561091 authored by Sam Thursfield's avatar Sam Thursfield

functional-tests: await_property_changed() should look for deletes too

This fixes the 410-extractor-decorator test.
parent cacb5b8c
...@@ -460,30 +460,32 @@ class StoreHelper (Helper): ...@@ -460,30 +460,32 @@ class StoreHelper (Helper):
property_id = self.get_resource_id_by_uri(property_uri) property_id = self.get_resource_id_by_uri(property_uri)
def find_property_change (inserts_list): def find_property_change (event_list):
matched = False matched = False
remaining_events = [] remaining_events = []
for insert in inserts_list: for event in event_list:
if insert[1] == subject_id and insert[2] == property_id: if event[1] == subject_id and event[2] == property_id:
log("Matched property change: %s" % str(insert)) log("Matched property change: %s" % str(event))
matched = True matched = True
else: else:
remaining_events += [insert] remaining_events += [event]
return matched, remaining_events return matched, remaining_events
def match_cb (inserts_list): def match_cb (event_list):
matched, remaining_events = find_property_change (inserts_list) matched, remaining_events = find_property_change (event_list)
exit_loop = matched exit_loop = matched
return exit_loop, remaining_events return exit_loop, remaining_events
# Check the list of previously received events for matches # Check the list of previously received events for matches
(existing_match, self.inserts_list) = find_property_change (self.inserts_list) (existing_match, self.inserts_list) = find_property_change (self.inserts_list)
(existing_match, self.deletes_list) = find_property_change (self.deletes_list)
if not existing_match: if not existing_match:
self._enable_await_timeout () self._enable_await_timeout ()
self.inserts_match_function = match_cb self.inserts_match_function = match_cb
self.deletes_match_function = match_cb
# Run the event loop until the correct notification arrives # Run the event loop until the correct notification arrives
try: try:
self.loop.run_checked () self.loop.run_checked ()
...@@ -491,6 +493,7 @@ class StoreHelper (Helper): ...@@ -491,6 +493,7 @@ class StoreHelper (Helper):
raise GraphUpdateTimeoutException( raise GraphUpdateTimeoutException(
"Timeout waiting for property change, subject %i property %s (%i)" % (subject_id, property_uri, property_id)) "Timeout waiting for property change, subject %i property %s (%i)" % (subject_id, property_uri, property_id))
self.inserts_match_function = None self.inserts_match_function = None
self.deletes_match_function = None
self.class_to_track = None self.class_to_track = None
def query (self, query, timeout=5000, **kwargs): def query (self, query, timeout=5000, **kwargs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment