2019-06-19 11:35:26 +00:00
|
|
|
"""Tests that emulates the behaviour of a WorkbenchServer."""
|
2018-09-08 14:46:39 +00:00
|
|
|
import json
|
|
|
|
import pathlib
|
2018-07-19 19:25:06 +00:00
|
|
|
|
2019-06-19 11:35:26 +00:00
|
|
|
import math
|
2018-06-19 16:38:42 +00:00
|
|
|
import pytest
|
2018-08-03 16:15:08 +00:00
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
from ereuse_devicehub.client import UserClient
|
2019-05-11 14:27:22 +00:00
|
|
|
from ereuse_devicehub.resources.action import models as em
|
2020-07-07 15:17:41 +00:00
|
|
|
from ereuse_devicehub.resources.action.models import RateComputer, BenchmarkProcessor, BenchmarkRamSysbench
|
2018-07-19 19:25:06 +00:00
|
|
|
from ereuse_devicehub.resources.device.exceptions import NeedsId
|
2018-06-10 16:47:49 +00:00
|
|
|
from ereuse_devicehub.resources.device.models import Device
|
2018-06-19 16:38:42 +00:00
|
|
|
from ereuse_devicehub.resources.tag.model import Tag
|
2020-10-15 11:19:47 +00:00
|
|
|
from tests.conftest import file, file_workbench
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
|
2020-07-07 15:17:41 +00:00
|
|
|
@pytest.mark.mvp
|
2018-06-19 16:38:42 +00:00
|
|
|
def test_workbench_server_condensed(user: UserClient):
|
2019-06-19 11:35:26 +00:00
|
|
|
"""As :def:`.test_workbench_server_phases` but all the actions
|
2018-06-19 16:38:42 +00:00
|
|
|
condensed in only one big ``Snapshot`` file, as described
|
|
|
|
in the docs.
|
|
|
|
"""
|
|
|
|
s = file('workbench-server-1.snapshot')
|
2019-05-11 14:27:22 +00:00
|
|
|
s['device']['actions'].append(file('workbench-server-2.stress-test'))
|
|
|
|
s['components'][4]['actions'].extend((
|
2018-06-19 16:38:42 +00:00
|
|
|
file('workbench-server-3.erase'),
|
|
|
|
file('workbench-server-4.install')
|
|
|
|
))
|
2019-05-11 14:27:22 +00:00
|
|
|
s['components'][5]['actions'].append(file('workbench-server-3.erase'))
|
2018-06-19 16:38:42 +00:00
|
|
|
# Create tags
|
2018-09-20 07:28:52 +00:00
|
|
|
for t in s['device']['tags']:
|
|
|
|
user.post({'id': t['id']}, res=Tag)
|
|
|
|
|
2018-07-19 19:25:06 +00:00
|
|
|
snapshot, _ = user.post(res=em.Snapshot, data=s)
|
2019-05-11 14:27:22 +00:00
|
|
|
actions = snapshot['actions']
|
|
|
|
assert {(action['type'], action['device']) for action in actions} == {
|
2018-06-19 16:38:42 +00:00
|
|
|
('BenchmarkProcessorSysbench', 5),
|
|
|
|
('StressTest', 1),
|
|
|
|
('EraseSectors', 6),
|
2020-07-07 15:17:41 +00:00
|
|
|
('EreusePrice', 1),
|
2018-06-19 16:38:42 +00:00
|
|
|
('BenchmarkRamSysbench', 1),
|
|
|
|
('BenchmarkProcessor', 5),
|
|
|
|
('Install', 6),
|
|
|
|
('EraseSectors', 7),
|
|
|
|
('BenchmarkDataStorage', 6),
|
2018-10-13 12:53:46 +00:00
|
|
|
('BenchmarkDataStorage', 7),
|
2019-04-30 00:02:23 +00:00
|
|
|
('TestDataStorage', 6),
|
2019-05-10 16:00:38 +00:00
|
|
|
('RateComputer', 1)
|
2018-06-19 16:38:42 +00:00
|
|
|
}
|
|
|
|
assert snapshot['closed']
|
2018-11-08 16:37:14 +00:00
|
|
|
assert snapshot['severity'] == 'Info'
|
2018-10-13 12:53:46 +00:00
|
|
|
device, _ = user.get(res=Device, item=snapshot['device']['id'])
|
|
|
|
assert device['dataStorageSize'] == 1100
|
|
|
|
assert device['chassis'] == 'Tower'
|
2020-11-13 10:11:35 +00:00
|
|
|
assert device['hid'] == 'desktop-d1mr-d1ml-d1s-na1-s'
|
2018-10-13 12:53:46 +00:00
|
|
|
assert device['graphicCardModel'] == device['components'][0]['model'] == 'gc1-1ml'
|
|
|
|
assert device['networkSpeeds'] == [1000, 58]
|
|
|
|
assert device['processorModel'] == device['components'][3]['model'] == 'p1-1ml'
|
|
|
|
assert device['ramSize'] == 2048, 'There are 3 RAM: 2 x 1024 and 1 None sizes'
|
|
|
|
assert device['rate']['closed']
|
2018-11-08 16:37:14 +00:00
|
|
|
assert device['rate']['severity'] == 'Info'
|
2020-07-07 15:17:41 +00:00
|
|
|
assert device['rate']['rating'] == 1
|
2019-05-14 18:32:24 +00:00
|
|
|
assert device['rate']['type'] == RateComputer.t
|
2020-07-07 15:17:41 +00:00
|
|
|
# TODO JN why haven't same order in actions on each execution?
|
|
|
|
assert device['actions'][2]['type'] == BenchmarkProcessor.t or device['actions'][2]['type'] == BenchmarkRamSysbench.t
|
2018-10-13 12:53:46 +00:00
|
|
|
assert device['tags'][0]['id'] == 'tag1'
|
2018-06-19 16:38:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.xfail(reason='Functionality not yet developed.')
|
2018-06-10 16:47:49 +00:00
|
|
|
def test_workbench_server_phases(user: UserClient):
|
2019-06-19 11:35:26 +00:00
|
|
|
"""Tests the phases described in the docs section `Snapshots from
|
2018-06-10 16:47:49 +00:00
|
|
|
Workbench <http://devicehub.ereuse.org/
|
2019-05-11 14:27:22 +00:00
|
|
|
actions.html#snapshots-from-workbench>`_.
|
2018-06-10 16:47:49 +00:00
|
|
|
"""
|
|
|
|
# 1. Snapshot with sync / rate / benchmarks / test data storage
|
|
|
|
s = file('workbench-server-1.snapshot')
|
2018-07-19 19:25:06 +00:00
|
|
|
snapshot, _ = user.post(res=em.Snapshot, data=s)
|
2019-05-11 14:27:22 +00:00
|
|
|
assert not snapshot['closed'], 'Snapshot must be waiting for the new actions'
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
# 2. stress test
|
|
|
|
st = file('workbench-server-2.stress-test')
|
|
|
|
st['snapshot'] = snapshot['id']
|
2018-07-19 19:25:06 +00:00
|
|
|
stress_test, _ = user.post(res=em.StressTest, data=st)
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
# 3. erase
|
|
|
|
ssd_id, hdd_id = snapshot['components'][4]['id'], snapshot['components'][5]['id']
|
|
|
|
e = file('workbench-server-3.erase')
|
|
|
|
e['snapshot'], e['device'] = snapshot['id'], ssd_id
|
2018-07-19 19:25:06 +00:00
|
|
|
erase1, _ = user.post(res=em.EraseSectors, data=e)
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
# 3 bis. a second erase
|
|
|
|
e = file('workbench-server-3.erase')
|
|
|
|
e['snapshot'], e['device'] = snapshot['id'], hdd_id
|
2018-07-19 19:25:06 +00:00
|
|
|
erase2, _ = user.post(res=em.EraseSectors, data=e)
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
# 4. Install
|
|
|
|
i = file('workbench-server-4.install')
|
|
|
|
i['snapshot'], i['device'] = snapshot['id'], ssd_id
|
2018-07-19 19:25:06 +00:00
|
|
|
install, _ = user.post(res=em.Install, data=i)
|
2018-06-10 16:47:49 +00:00
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
# Check actions have been appended in Snapshot and devices
|
2018-06-10 16:47:49 +00:00
|
|
|
# and that Snapshot is closed
|
2018-07-19 19:25:06 +00:00
|
|
|
snapshot, _ = user.get(res=em.Snapshot, item=snapshot['id'])
|
2019-05-11 14:27:22 +00:00
|
|
|
actions = snapshot['actions']
|
|
|
|
assert len(actions) == 9
|
|
|
|
assert actions[0]['type'] == 'Rate'
|
|
|
|
assert actions[0]['device'] == 1
|
|
|
|
assert actions[0]['closed']
|
|
|
|
assert actions[0]['type'] == 'RateComputer'
|
|
|
|
assert actions[0]['device'] == 1
|
|
|
|
assert actions[1]['type'] == 'BenchmarkProcessor'
|
|
|
|
assert actions[1]['device'] == 5
|
|
|
|
assert actions[2]['type'] == 'BenchmarkProcessorSysbench'
|
|
|
|
assert actions[2]['device'] == 5
|
|
|
|
assert actions[3]['type'] == 'BenchmarkDataStorage'
|
|
|
|
assert actions[3]['device'] == 6
|
|
|
|
assert actions[4]['type'] == 'TestDataStorage'
|
|
|
|
assert actions[4]['device'] == 6
|
|
|
|
assert actions[4]['type'] == 'BenchmarkDataStorage'
|
|
|
|
assert actions[4]['device'] == 7
|
|
|
|
assert actions[5]['type'] == 'StressTest'
|
|
|
|
assert actions[5]['device'] == 1
|
|
|
|
assert actions[6]['type'] == 'EraseSectors'
|
|
|
|
assert actions[6]['device'] == 6
|
|
|
|
assert actions[7]['type'] == 'EraseSectors'
|
|
|
|
assert actions[7]['device'] == 7
|
|
|
|
assert actions[8]['type'] == 'Install'
|
|
|
|
assert actions[8]['device'] == 6
|
2018-06-10 16:47:49 +00:00
|
|
|
assert snapshot['closed']
|
2018-11-08 16:37:14 +00:00
|
|
|
assert snapshot['severity'] == 'Info'
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
pc, _ = user.get(res=Device, item=snapshot['id'])
|
2019-05-11 14:27:22 +00:00
|
|
|
assert len(pc['actions']) == 10 # todo shall I add child actions?
|
2018-07-02 10:52:54 +00:00
|
|
|
|
|
|
|
|
2020-07-07 15:17:41 +00:00
|
|
|
@pytest.mark.mvp
|
2018-07-02 10:52:54 +00:00
|
|
|
def test_real_hp_11(user: UserClient):
|
|
|
|
s = file('real-hp.snapshot.11')
|
2018-07-19 19:25:06 +00:00
|
|
|
snapshot, _ = user.post(res=em.Snapshot, data=s)
|
2018-10-13 12:53:46 +00:00
|
|
|
pc = snapshot['device']
|
2020-11-13 10:11:35 +00:00
|
|
|
assert pc['hid'] == 'desktop-hewlett-packard-hp_compaq_8100_elite_sff-czc0408yjg-6c:62:6d:81:22:9f'
|
2018-10-13 12:53:46 +00:00
|
|
|
assert pc['chassis'] == 'Tower'
|
2019-05-11 14:27:22 +00:00
|
|
|
assert set(e['type'] for e in snapshot['actions']) == {
|
2018-10-23 14:24:26 +00:00
|
|
|
'EreusePrice',
|
2019-04-23 19:30:08 +00:00
|
|
|
'RateComputer',
|
2018-07-02 10:52:54 +00:00
|
|
|
'BenchmarkDataStorage',
|
|
|
|
'BenchmarkProcessor',
|
|
|
|
'BenchmarkProcessorSysbench',
|
|
|
|
'TestDataStorage',
|
|
|
|
'BenchmarkRamSysbench',
|
2019-04-30 00:02:23 +00:00
|
|
|
'StressTest',
|
2019-05-08 17:12:05 +00:00
|
|
|
'TestBios',
|
|
|
|
'VisualTest'
|
2018-07-02 10:52:54 +00:00
|
|
|
}
|
2019-05-11 14:27:22 +00:00
|
|
|
assert len(list(e['type'] for e in snapshot['actions'])) == 10
|
2018-10-13 12:53:46 +00:00
|
|
|
assert pc['networkSpeeds'] == [1000, None], 'Device has no WiFi'
|
|
|
|
assert pc['processorModel'] == 'intel core i3 cpu 530 @ 2.93ghz'
|
|
|
|
assert pc['ramSize'] == 8192
|
|
|
|
assert pc['dataStorageSize'] == 305245
|
2018-10-23 14:24:26 +00:00
|
|
|
# todo check rating
|
2018-07-02 10:52:54 +00:00
|
|
|
|
|
|
|
|
2020-07-07 15:17:41 +00:00
|
|
|
@pytest.mark.mvp
|
2018-07-02 10:52:54 +00:00
|
|
|
def test_real_toshiba_11(user: UserClient):
|
|
|
|
s = file('real-toshiba.snapshot.11')
|
2018-07-19 19:25:06 +00:00
|
|
|
snapshot, _ = user.post(res=em.Snapshot, data=s)
|
|
|
|
|
|
|
|
|
2020-07-07 15:17:41 +00:00
|
|
|
@pytest.mark.mvp
|
2019-05-10 09:58:38 +00:00
|
|
|
def test_snapshot_real_eee_1001pxd_with_rate(user: UserClient):
|
2019-06-19 11:35:26 +00:00
|
|
|
"""Checks the values of the device, components,
|
2019-05-11 14:27:22 +00:00
|
|
|
actions and their relationships of a real pc.
|
2018-07-19 19:25:06 +00:00
|
|
|
"""
|
|
|
|
s = file('real-eee-1001pxd.snapshot.11')
|
|
|
|
snapshot, _ = user.post(res=em.Snapshot, data=s)
|
|
|
|
pc, _ = user.get(res=Device, item=snapshot['device']['id'])
|
|
|
|
assert pc['type'] == 'Laptop'
|
|
|
|
assert pc['chassis'] == 'Netbook'
|
2018-09-30 10:29:33 +00:00
|
|
|
assert pc['model'] == '1001pxd'
|
|
|
|
assert pc['serialNumber'] == 'b8oaas048286'
|
|
|
|
assert pc['manufacturer'] == 'asustek computer inc.'
|
2020-11-13 10:11:35 +00:00
|
|
|
assert pc['hid'] == 'laptop-asustek_computer_inc-1001pxd-b8oaas048286-14:da:e9:42:f6:7c'
|
2018-07-19 19:25:06 +00:00
|
|
|
assert pc['tags'] == []
|
2018-10-13 12:53:46 +00:00
|
|
|
assert pc['networkSpeeds'] == [100, 0], 'Although it has WiFi we do not know the speed'
|
2018-10-23 14:24:26 +00:00
|
|
|
assert pc['rate']
|
|
|
|
rate = pc['rate']
|
2019-05-11 14:27:22 +00:00
|
|
|
# assert pc['actions'][0]['appearanceRange'] == 'A'
|
|
|
|
# assert pc['actions'][0]['functionalityRange'] == 'B'
|
2019-04-30 00:02:23 +00:00
|
|
|
# TODO add appearance and functionality Range in device[rate]
|
|
|
|
|
2020-07-07 15:17:41 +00:00
|
|
|
assert rate['processorRange'] == 'LOW'
|
|
|
|
assert rate['ramRange'] == 'LOW'
|
|
|
|
assert rate['ratingRange'] == 'LOW'
|
2018-10-23 14:24:26 +00:00
|
|
|
assert rate['ram'] == 1.53
|
2019-04-30 00:02:23 +00:00
|
|
|
# TODO add camelCase instead of snake_case
|
|
|
|
assert rate['dataStorage'] == 3.76
|
|
|
|
assert rate['type'] == 'RateComputer'
|
2018-07-19 19:25:06 +00:00
|
|
|
components = snapshot['components']
|
|
|
|
wifi = components[0]
|
2019-01-02 16:52:43 +00:00
|
|
|
assert wifi['hid'] == 'networkadapter-qualcomm_atheros-' \
|
|
|
|
'ar9285_wireless_network_adapter-74_2f_68_8b_fd_c8'
|
2018-07-19 19:25:06 +00:00
|
|
|
assert wifi['serialNumber'] == '74:2f:68:8b:fd:c8'
|
|
|
|
assert wifi['wireless']
|
|
|
|
eth = components[1]
|
2019-01-02 16:52:43 +00:00
|
|
|
assert eth['hid'] == 'networkadapter-qualcomm_atheros-' \
|
|
|
|
'ar8152_v2_0_fast_ethernet-14_da_e9_42_f6_7c'
|
2018-07-19 19:25:06 +00:00
|
|
|
assert eth['speed'] == 100
|
|
|
|
assert not eth['wireless']
|
|
|
|
cpu = components[2]
|
|
|
|
assert cpu['address'] == 64
|
|
|
|
assert cpu['cores'] == 1
|
|
|
|
assert cpu['threads'] == 1
|
|
|
|
assert cpu['speed'] == 1.667
|
|
|
|
assert 'hid' not in cpu
|
2018-10-13 12:53:46 +00:00
|
|
|
assert pc['processorModel'] == cpu['model'] == 'intel atom cpu n455 @ 1.66ghz'
|
2018-07-19 19:25:06 +00:00
|
|
|
cpu, _ = user.get(res=Device, item=cpu['id'])
|
2019-05-11 14:27:22 +00:00
|
|
|
actions = cpu['actions']
|
|
|
|
sysbench = next(e for e in actions if e['type'] == em.BenchmarkProcessorSysbench.t)
|
2018-07-19 19:25:06 +00:00
|
|
|
assert sysbench['elapsed'] == 164
|
2018-11-27 18:06:28 +00:00
|
|
|
assert math.isclose(sysbench['rate'], 164, rel_tol=0.001)
|
2018-07-19 19:25:06 +00:00
|
|
|
assert sysbench['snapshot'] == snapshot['id']
|
|
|
|
assert sysbench['device'] == cpu['id']
|
|
|
|
assert sysbench['parent'] == pc['id']
|
2019-05-11 14:27:22 +00:00
|
|
|
benchmark_cpu = next(e for e in actions if e['type'] == em.BenchmarkProcessor.t)
|
2018-11-27 18:06:28 +00:00
|
|
|
assert math.isclose(benchmark_cpu['rate'], 6666, rel_tol=0.001)
|
2018-07-19 19:25:06 +00:00
|
|
|
assert benchmark_cpu['elapsed'] == 0
|
2019-05-11 14:27:22 +00:00
|
|
|
action_types = tuple(e['type'] for e in actions)
|
|
|
|
assert em.BenchmarkRamSysbench.t in action_types
|
|
|
|
assert em.StressTest.t in action_types
|
|
|
|
assert em.Snapshot.t in action_types
|
2020-07-07 15:17:41 +00:00
|
|
|
assert len(actions) == 8
|
2018-07-19 19:25:06 +00:00
|
|
|
gpu = components[3]
|
2018-09-30 10:29:33 +00:00
|
|
|
assert gpu['model'] == 'atom processor d4xx/d5xx/n4xx/n5xx integrated graphics controller'
|
|
|
|
assert gpu['manufacturer'] == 'intel corporation'
|
2018-07-19 19:25:06 +00:00
|
|
|
assert gpu['memory'] == 256
|
|
|
|
gpu, _ = user.get(res=Device, item=gpu['id'])
|
2019-05-11 14:27:22 +00:00
|
|
|
action_types = tuple(e['type'] for e in gpu['actions'])
|
|
|
|
assert em.BenchmarkRamSysbench.t in action_types
|
|
|
|
assert em.StressTest.t in action_types
|
|
|
|
assert em.Snapshot.t in action_types
|
2020-07-07 15:17:41 +00:00
|
|
|
assert len(action_types) == 6
|
2018-07-19 19:25:06 +00:00
|
|
|
sound = components[4]
|
2018-09-30 10:29:33 +00:00
|
|
|
assert sound['model'] == 'nm10/ich7 family high definition audio controller'
|
2018-07-19 19:25:06 +00:00
|
|
|
sound = components[5]
|
2018-09-30 10:29:33 +00:00
|
|
|
assert sound['model'] == 'usb 2.0 uvc vga webcam'
|
2018-07-19 19:25:06 +00:00
|
|
|
ram = components[6]
|
|
|
|
assert ram['interface'] == 'DDR2'
|
|
|
|
assert ram['speed'] == 667
|
2018-10-13 12:53:46 +00:00
|
|
|
assert pc['ramSize'] == ram['size'] == 1024
|
2018-07-19 19:25:06 +00:00
|
|
|
hdd = components[7]
|
|
|
|
assert hdd['type'] == 'HardDrive'
|
2019-01-02 16:52:43 +00:00
|
|
|
assert hdd['hid'] == 'harddrive-hitachi-hts54322-e2024242cv86hj'
|
2018-07-19 19:25:06 +00:00
|
|
|
assert hdd['interface'] == 'ATA'
|
|
|
|
assert hdd['size'] == 238475
|
|
|
|
hdd, _ = user.get(res=Device, item=hdd['id'])
|
2019-05-11 14:27:22 +00:00
|
|
|
action_types = tuple(e['type'] for e in hdd['actions'])
|
|
|
|
assert em.BenchmarkRamSysbench.t in action_types
|
|
|
|
assert em.StressTest.t in action_types
|
|
|
|
assert em.BenchmarkDataStorage.t in action_types
|
|
|
|
assert em.TestDataStorage.t in action_types
|
|
|
|
assert em.EraseBasic.t in action_types
|
|
|
|
assert em.Snapshot.t in action_types
|
2020-07-07 15:17:41 +00:00
|
|
|
assert len(action_types) == 9
|
2019-05-11 14:27:22 +00:00
|
|
|
erase = next(e for e in hdd['actions'] if e['type'] == em.EraseBasic.t)
|
2018-07-19 19:25:06 +00:00
|
|
|
assert erase['endTime']
|
|
|
|
assert erase['startTime']
|
2018-11-08 16:37:14 +00:00
|
|
|
assert erase['severity'] == 'Info'
|
2018-11-27 18:06:28 +00:00
|
|
|
assert hdd['privacy']['type'] == 'EraseBasic'
|
2018-07-19 19:25:06 +00:00
|
|
|
mother = components[8]
|
2019-01-02 16:52:43 +00:00
|
|
|
assert mother['hid'] == 'motherboard-asustek_computer_inc-1001pxd-eee0123456789'
|
2018-07-19 19:25:06 +00:00
|
|
|
|
|
|
|
|
2020-07-07 15:17:41 +00:00
|
|
|
@pytest.mark.mvp
|
2018-07-19 19:25:06 +00:00
|
|
|
def test_real_custom(user: UserClient):
|
|
|
|
s = file('real-custom.snapshot.11')
|
2020-07-15 11:11:50 +00:00
|
|
|
snapshot, _ = user.post(res=em.Snapshot, data=s, status=201)
|
2018-07-19 19:25:06 +00:00
|
|
|
# todo insert with tag
|
|
|
|
|
|
|
|
|
2020-07-07 15:17:41 +00:00
|
|
|
@pytest.mark.mvp
|
2018-07-19 19:25:06 +00:00
|
|
|
def test_real_hp_quad_core(user: UserClient):
|
|
|
|
s = file('real-hp-quad-core.snapshot.11')
|
|
|
|
snapshot, _ = user.post(res=em.Snapshot, data=s)
|
2018-09-08 14:46:39 +00:00
|
|
|
|
|
|
|
|
2020-07-07 15:17:41 +00:00
|
|
|
@pytest.mark.mvp
|
2018-09-08 14:46:39 +00:00
|
|
|
def test_real_eee_1000h(user: UserClient):
|
|
|
|
s = file('asus-eee-1000h.snapshot.11')
|
|
|
|
snapshot, _ = user.post(res=em.Snapshot, data=s)
|
|
|
|
|
|
|
|
|
|
|
|
SNAPSHOTS_NEED_ID = {
|
2019-06-29 14:26:14 +00:00
|
|
|
'core2.snapshot.json',
|
|
|
|
'asus-all-series.snapshot.json',
|
|
|
|
'all-series.snapshot.json',
|
|
|
|
'nox.snapshot.json',
|
|
|
|
'ecs-computers.snapshot.json',
|
|
|
|
'custom.snapshot.json',
|
|
|
|
'ecs-2.snapshot.json'
|
2018-09-08 14:46:39 +00:00
|
|
|
}
|
|
|
|
"""Snapshots that do not generate HID requiring a custom ID."""
|
|
|
|
|
|
|
|
|
2020-07-15 11:11:50 +00:00
|
|
|
@pytest.mark.mvp
|
2018-09-08 14:46:39 +00:00
|
|
|
@pytest.mark.parametrize('file',
|
2019-06-29 14:26:14 +00:00
|
|
|
(pytest.param(f, id=f.name)
|
2019-07-07 19:38:37 +00:00
|
|
|
for f in pathlib.Path(__file__).parent.joinpath('workbench_files').iterdir())
|
2019-06-29 14:26:14 +00:00
|
|
|
)
|
2018-09-08 14:46:39 +00:00
|
|
|
def test_workbench_fixtures(file: pathlib.Path, user: UserClient):
|
|
|
|
"""Uploads the Snapshot files Workbench tests generate.
|
|
|
|
|
|
|
|
Keep this files up to date with the Workbench version.
|
|
|
|
"""
|
|
|
|
s = json.load(file.open())
|
|
|
|
user.post(res=em.Snapshot,
|
|
|
|
data=s,
|
2020-07-20 10:45:41 +00:00
|
|
|
status=201)
|
2018-10-14 21:56:54 +00:00
|
|
|
|
|
|
|
|
2020-07-07 15:17:41 +00:00
|
|
|
@pytest.mark.mvp
|
2018-10-14 21:56:54 +00:00
|
|
|
def test_workbench_asus_1001pxd_rate_low(user: UserClient):
|
|
|
|
"""Tests an Asus 1001pxd with a low rate."""
|
|
|
|
s = file('asus-1001pxd.snapshot')
|
|
|
|
snapshot, _ = user.post(res=em.Snapshot, data=s)
|
2018-10-27 06:56:58 +00:00
|
|
|
|
|
|
|
|
2020-07-07 15:17:41 +00:00
|
|
|
@pytest.mark.mvp
|
2018-10-27 06:56:58 +00:00
|
|
|
def test_david(user: UserClient):
|
|
|
|
s = file('david.lshw.snapshot')
|
|
|
|
snapshot, _ = user.post(res=em.Snapshot, data=s)
|
2020-10-15 11:19:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_eresueprice_computer_type(user: UserClient):
|
|
|
|
s = file_workbench('computer-type.snapshot')
|
|
|
|
snapshot, _ = user.post(res=em.Snapshot, data=s)
|