add new test snapshot lite for clonic desktop

This commit is contained in:
Cayo Puigdefabregas 2022-04-18 17:13:38 +02:00
parent 99e7764945
commit 093e78d2c8
2 changed files with 25 additions and 0 deletions

File diff suppressed because one or more lines are too long

View file

@ -1130,3 +1130,27 @@ def test_snapshot_errors_timestamp(user: UserClient):
error = SnapshotErrors.query.all()[0]
assert snapshot_lite['wbid'] == error.wbid
assert user.user['id'] == str(error.owner_id)
@pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__)
def test_snapshot_errors_no_serial_number(user: UserClient):
"""This test check the minimum validation of json that come from snapshot"""
snapshot_lite = file_json('desktop-amd-bug-no-sn.json')
bodyLite, res = user.post(snapshot_lite, uri="/api/inventory/")
assert res.status_code == 201
assert len(SnapshotErrors.query.all()) == 0
dev = m.Device.query.filter_by(id=bodyLite['device']['id']).one()
assert not dev.model
assert not dev.manufacturer
assert not dev.serial_number
assert dev.type == "Desktop"
for c in dev.components:
if not c.type == "HardDrive":
continue
assert c.serial_number == 'vd051gtf024b4l'
assert c.model == "hdt722520dlat80"
assert not c.manufacturer
test = c.actions[-1]
assert test.power_on_hours == 19819