test of delete devices

This commit is contained in:
Cayo Puigdefabregas 2021-10-05 09:56:57 +02:00
parent baa5fccda0
commit 83c4cc2d8b
1 changed files with 17 additions and 0 deletions

View File

@ -2500,3 +2500,20 @@ def test_moveOnDocument(user: UserClient, user2: UserClient):
assert description == mvs.description assert description == mvs.description
tradedocument_to, _ = user.post(res=TradeDocument, data=request_post2) tradedocument_to, _ = user.post(res=TradeDocument, data=request_post2)
user.post(res=models.Action, data=request_moveOn, status=422) user.post(res=models.Action, data=request_moveOn, status=422)
@pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__)
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}
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'])
assert db_device.action[-1].t == 'Delete'
assert db_device.active == False