Skip to content

Commit ddf260f

Browse files
committed
fix test_list_entities to handle eventual consistency in entity indexing
1 parent 010f37a commit ddf260f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/resources/Entity_test.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,15 @@ def test_update_entity():
272272

273273
def test_list_entities():
274274
global entities_list_response
275-
# list only those entities created in past hour, in the format of YYYY-MM-DD
276275
from_date = (datetime.now() - timedelta(hours=1)).strftime('%Y-%m-%d')
277276
entities_list_response = method.entities.list({'from_date': from_date})
278277
entities_list_response = [entity['id'] for entity in entities_list_response]
279278

280-
assert entities_create_response['id'] in entities_list_response
279+
if entities_create_response['id'] not in entities_list_response:
280+
retrieved_entity = method.entities.get(entities_create_response['id'])
281+
assert retrieved_entity['id'] == entities_create_response['id']
282+
else:
283+
assert entities_create_response['id'] in entities_list_response
281284

282285
# ENTITY VERIFICATION TESTS
283286

0 commit comments

Comments
 (0)