From dc3b9ebf2d718f418eeaf4c8b39472acdb8623e7 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 5 Oct 2021 11:55:43 +0200 Subject: [PATCH] fixing test --- tests/test_action.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/test_action.py b/tests/test_action.py index d1eb0915..5173a605 100644 --- a/tests/test_action.py +++ b/tests/test_action.py @@ -2508,12 +2508,15 @@ def test_delete_devices(user: UserClient): """This action deactive one device and simulate than one devices is delete.""" snap, _ = user.post(file('acer.happy.battery.snapshot'), res=models.Snapshot) - request = {'type': 'Delete', 'devices': [snap['device']['id']], 'name': 'borrado universal', 'severity': 'Info', 'description': 'duplicity of devices', 'endTime': '2021-07-07T22:00:00.000Z', 'success': 1} + request = {'type': 'Delete', 'devices': [snap['device']['id']], 'name': 'borrado universal', 'severity': 'Info', 'description': 'duplicity of devices', 'endTime': '2021-07-07T22:00:00.000Z'} - user.post(res=models.Action, data=request) + action, _ = user.post(res=models.Action, data=request) - user.get(res=Device, itm=snap['device']['devicehubID'], status=422) - db_device = Device.query.filter_by(id=snap['device']['id']) + user.get(res=Device, item=snap['device']['devicehubID']) + db_device = Device.query.filter_by(id=snap['device']['id']).one() - assert db_device.action[-1].t == 'Delete' + action_delete = sorted(db_device.actions, key=lambda x: x.created)[-1] + + assert action_delete.t == 'Delete' + assert str(action_delete.id) == action['id'] assert db_device.active == False