add action data storage test

This commit is contained in:
Cayo Puigdefabregas 2022-03-29 11:24:54 +02:00
parent f4a657052a
commit f3e8fa6cc1
1 changed files with 5 additions and 3 deletions

View File

@ -1028,17 +1028,19 @@ def test_min_validate_fields(user: UserClient):
@pytest.mark.mvp @pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__)
def test_snapshot_wb_lite(user: UserClient): def test_snapshot_wb_lite(user: UserClient):
"""This test check the minimum validation of json that come from snapshot""" """This test check the minimum validation of json that come from snapshot"""
# import pdb; pdb.set_trace()
snapshot = file_json("example_wb14_x1.json") snapshot = file_json("example_wb14_x1.json")
body, res = user.post(snapshot, res=Snapshot) body, res = user.post(snapshot, res=Snapshot)
# a = [x['type'] for x in body['components']]
ssd = [x for x in body['components'] if x['type'] == 'SolidStateDrive'][0] ssd = [x for x in body['components'] if x['type'] == 'SolidStateDrive'][0]
assert body['device']['manufacturer'] == 'lenovo' assert body['device']['manufacturer'] == 'lenovo'
assert ssd['serialNumber'] == 's35anx0j' assert ssd['serialNumber'] == 's35anx0j'
assert res.status == '201 CREATED' assert res.status == '201 CREATED'
assert '00:28:f8:a6:d5:7e' in body['device']['hid']
dev = m.Device.query.filter_by(id=body['device']['id']).one()
assert dev.actions[0].power_on_hours == 6013