From a600dd8e5462c6c477b0c938157f781264f100d0 Mon Sep 17 00:00:00 2001 From: Xavier Bustamante Talavera Date: Sat, 27 Oct 2018 09:01:13 +0200 Subject: [PATCH] Fix test_test_data_storage --- tests/test_snapshot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_snapshot.py b/tests/test_snapshot.py index 33e0b93c..f8708e44 100644 --- a/tests/test_snapshot.py +++ b/tests/test_snapshot.py @@ -326,7 +326,10 @@ def test_test_data_storage(user: UserClient): """Tests a Snapshot with EraseSectors.""" s = file('erase-sectors-2-hdd.snapshot') snapshot, _ = user.post(res=Snapshot, data=s) - incidence_test = next(ev for ev in snapshot['events'] if ev['reallocatedSectorCount'] == 15) + incidence_test = next( + ev for ev in snapshot['events'] + if ev.get('reallocatedSectorCount', None) == 15 + ) assert incidence_test['incidence'] assert incidence_test['description'] == 'Warning: Drive failure expected soon.'