add test exports actions erasure

This commit is contained in:
Cayo Puigdefabregas 2022-09-21 12:04:34 +02:00
parent 47736c8679
commit ad9b9e4e83
2 changed files with 15 additions and 0 deletions

View File

@ -922,6 +922,7 @@ class ExportsView(View):
args = request.args.get('ids')
ids = args.split(',') if args else []
ids = [id.strip() for id in ids]
query = EraseBasic.query.filter_by(author=g.user)
query = query.filter(EraseBasic.id.in_(ids))

View File

@ -260,6 +260,20 @@ def test_export_certificates(user3: UserClientFlask):
assert 'hts54322' in body
@pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__)
def test_export_actions_erasure(user3: UserClientFlask):
snap = create_device(user3, 'erase-sectors-2-hdd.snapshot')
ids = [str(ac.id) for ac in snap.actions if ac.type == 'EraseBasic']
ids = ",".join(ids)
uri = "/inventory/export/actions_erasures/?ids={id}".format(id=ids)
body, status = user3.get(uri)
assert status == '200 OK'
assert "WD-WCAV27984668" in body
assert "WD-WCAV29008961" in body
@pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__)
def test_labels(user3: UserClientFlask):