add test for EraseDataWipe

This commit is contained in:
Cayo Puigdefabregas 2023-05-26 17:35:53 +02:00
parent 2e2b346daa
commit a3b71ec996
1 changed files with 28 additions and 0 deletions

View File

@ -1375,6 +1375,34 @@ def test_action_datawipe(user3: UserClientFlask):
assert dev.binding.device.devicehub_id in body assert dev.binding.device.devicehub_id in body
@pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__)
def test_action_erasedatawipe(user3: UserClientFlask):
snap = create_device(user3, 'real-eee-1001pxd.snapshot.12.json')
dev = snap.device
uri = '/inventory/device/'
user3.get(uri)
b_file = b'1234567890'
file_name = "my_file.doc"
file_upload = (BytesIO(b_file), file_name)
data = {
'csrf_token': generate_csrf(),
'type': "EraseDataWipe",
'severity': "Info",
'devices': "{}".format(dev.binding.device.id),
'document-file_name': file_upload,
}
uri = '/inventory/action/datawipe/add/'
body, status = user3.post(uri, data=data, content_type="multipart/form-data")
assert status == '200 OK'
assert dev.binding.device.actions[-1].type == 'EraseDataWipe'
assert 'Action "EraseDataWipe" created successfully!' in body
assert dev.binding.device.devicehub_id in body
@pytest.mark.mvp @pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__) @pytest.mark.usefixtures(conftest.app_context.__name__)
def test_wb_settings(user3: UserClientFlask): def test_wb_settings(user3: UserClientFlask):