fix tests
This commit is contained in:
parent
8fa1f41006
commit
9bb03d282d
|
@ -1,2 +1,2 @@
|
||||||
Type,Chassis,Serial Number,Model,Manufacturer,Registered in,Physical state,Trading state,Price,Processor,RAM (MB),Data Storage Size (MB),Rate,Range,Processor Rate,Processor Range,RAM Rate,RAM Range,Data Storage Rate,Data Storage Range
|
Type;Chassis;Serial Number;Model;Manufacturer;Registered in;Physical state;Trading state;Price;Processor;RAM (MB);Data Storage Size (MB)
|
||||||
Desktop,Microtower,d1s,d1ml,d1mr,Tue Jul 2 10:35:10 2019,,,,p1ml,0,0,1.0,Very low,1.0,Very low,1.0,Very low,1.0,Very low
|
Desktop;Microtower;d1s;d1ml;d1mr;Tue Mar 29 18:13:05 2022;;;;p1ml;0;0
|
||||||
|
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -130,6 +130,7 @@ def test_physical_properties():
|
||||||
'model': 'foo',
|
'model': 'foo',
|
||||||
'receiver_id': None,
|
'receiver_id': None,
|
||||||
'serial_number': 'foo-bar',
|
'serial_number': 'foo-bar',
|
||||||
|
'uuid': None,
|
||||||
'transfer_state': TransferState.Initial
|
'transfer_state': TransferState.Initial
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,7 +481,7 @@ def test_get_device_permissions(app: Devicehub, user: UserClient, user2: UserCli
|
||||||
s, _ = user.post(file('asus-eee-1000h.snapshot.11'), res=m.Snapshot)
|
s, _ = user.post(file('asus-eee-1000h.snapshot.11'), res=m.Snapshot)
|
||||||
pc, res = user.get(res=d.Device, item=s['device']['devicehubID'])
|
pc, res = user.get(res=d.Device, item=s['device']['devicehubID'])
|
||||||
assert res.status_code == 200
|
assert res.status_code == 200
|
||||||
assert len(pc['actions']) == 9
|
assert len(pc['actions']) == 7
|
||||||
|
|
||||||
html, _ = client.get(res=d.Device, item=s['device']['devicehubID'], accept=ANY)
|
html, _ = client.get(res=d.Device, item=s['device']['devicehubID'], accept=ANY)
|
||||||
assert 'intel atom cpu n270 @ 1.60ghz' in html
|
assert 'intel atom cpu n270 @ 1.60ghz' in html
|
||||||
|
|
|
@ -181,7 +181,7 @@ def test_device_query(user: UserClient):
|
||||||
assert i['url'] == '/devices/'
|
assert i['url'] == '/devices/'
|
||||||
assert i['items'][0]['url'] == '/devices/%s' % snapshot['device']['devicehubID']
|
assert i['items'][0]['url'] == '/devices/%s' % snapshot['device']['devicehubID']
|
||||||
pc = next(d for d in i['items'] if d['type'] == 'Desktop')
|
pc = next(d for d in i['items'] if d['type'] == 'Desktop')
|
||||||
assert len(pc['actions']) == 4
|
assert len(pc['actions']) == 3
|
||||||
assert len(pc['components']) == 3
|
assert len(pc['components']) == 3
|
||||||
assert pc['tags'][0]['id'] == pc['devicehubID']
|
assert pc['tags'][0]['id'] == pc['devicehubID']
|
||||||
|
|
||||||
|
|
|
@ -337,6 +337,7 @@ def test_export_computer_monitor(user: UserClient):
|
||||||
f = StringIO(csv_str)
|
f = StringIO(csv_str)
|
||||||
obj_csv = csv.reader(f, f)
|
obj_csv = csv.reader(f, f)
|
||||||
export_csv = list(obj_csv)
|
export_csv = list(obj_csv)
|
||||||
|
|
||||||
# Open fixture csv and transform to list
|
# Open fixture csv and transform to list
|
||||||
with Path(__file__).parent.joinpath('files').joinpath('computer-monitor.csv').open() \
|
with Path(__file__).parent.joinpath('files').joinpath('computer-monitor.csv').open() \
|
||||||
as csv_file:
|
as csv_file:
|
||||||
|
@ -435,12 +436,14 @@ def test_report_devices_stock_control(user: UserClient, user2: UserClient):
|
||||||
'Register in field is not a datetime'
|
'Register in field is not a datetime'
|
||||||
|
|
||||||
# Pop dates fields from csv lists to compare them
|
# Pop dates fields from csv lists to compare them
|
||||||
|
fixture_csv[1] = fixture_csv[1][0].split(";")
|
||||||
fixture_csv[1] = fixture_csv[1][:5] + fixture_csv[1][6:]
|
fixture_csv[1] = fixture_csv[1][:5] + fixture_csv[1][6:]
|
||||||
export_csv[1] = export_csv[1][:5] + export_csv[1][6:]
|
export_csv[1] = export_csv[1][:5] + export_csv[1][6:]
|
||||||
|
|
||||||
assert fixture_csv[0] == export_csv[0], 'Headers are not equal'
|
export_header = [";".join(export_csv[0])]
|
||||||
|
assert fixture_csv[0] == export_header, 'Headers are not equal'
|
||||||
assert fixture_csv[1] == export_csv[1], 'Computer information are not equal'
|
assert fixture_csv[1] == export_csv[1], 'Computer information are not equal'
|
||||||
assert fixture_csv == export_csv
|
assert fixture_csv == [export_header, export_csv[1]]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
|
|
|
@ -41,7 +41,6 @@ def test_workbench_server_condensed(user: UserClient):
|
||||||
('BenchmarkProcessorSysbench', cpu_id),
|
('BenchmarkProcessorSysbench', cpu_id),
|
||||||
('StressTest', pc_id),
|
('StressTest', pc_id),
|
||||||
('EraseSectors', ssd_id),
|
('EraseSectors', ssd_id),
|
||||||
('EreusePrice', pc_id),
|
|
||||||
('BenchmarkRamSysbench', pc_id),
|
('BenchmarkRamSysbench', pc_id),
|
||||||
('BenchmarkProcessor', cpu_id),
|
('BenchmarkProcessor', cpu_id),
|
||||||
('Install', ssd_id),
|
('Install', ssd_id),
|
||||||
|
@ -49,7 +48,6 @@ def test_workbench_server_condensed(user: UserClient):
|
||||||
('BenchmarkDataStorage', ssd_id),
|
('BenchmarkDataStorage', ssd_id),
|
||||||
('BenchmarkDataStorage', hdd_id),
|
('BenchmarkDataStorage', hdd_id),
|
||||||
('TestDataStorage', ssd_id),
|
('TestDataStorage', ssd_id),
|
||||||
('RateComputer', pc_id)
|
|
||||||
}
|
}
|
||||||
assert snapshot['closed']
|
assert snapshot['closed']
|
||||||
assert snapshot['severity'] == 'Info'
|
assert snapshot['severity'] == 'Info'
|
||||||
|
@ -61,10 +59,6 @@ def test_workbench_server_condensed(user: UserClient):
|
||||||
assert device['networkSpeeds'] == [1000, 58]
|
assert device['networkSpeeds'] == [1000, 58]
|
||||||
assert device['processorModel'] == device['components'][3]['model'] == 'p1-1ml'
|
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['ramSize'] == 2048, 'There are 3 RAM: 2 x 1024 and 1 None sizes'
|
||||||
assert device['rate']['closed']
|
|
||||||
assert device['rate']['severity'] == 'Info'
|
|
||||||
assert device['rate']['rating'] == 1
|
|
||||||
assert device['rate']['type'] == RateComputer.t
|
|
||||||
# TODO JN why haven't same order in actions on each execution?
|
# TODO JN why haven't same order in actions on each execution?
|
||||||
assert any([ac['type'] in [BenchmarkProcessor.t, BenchmarkRamSysbench.t] for ac in device['actions']])
|
assert any([ac['type'] in [BenchmarkProcessor.t, BenchmarkRamSysbench.t] for ac in device['actions']])
|
||||||
assert 'tag1' in [x['id'] for x in device['tags']]
|
assert 'tag1' in [x['id'] for x in device['tags']]
|
||||||
|
@ -145,8 +139,6 @@ def test_real_hp_11(user: UserClient):
|
||||||
assert pc['hid'] == 'desktop-hewlett-packard-hp_compaq_8100_elite_sff-czc0408yjg-6c:62:6d:81:22:9f'
|
assert pc['hid'] == 'desktop-hewlett-packard-hp_compaq_8100_elite_sff-czc0408yjg-6c:62:6d:81:22:9f'
|
||||||
assert pc['chassis'] == 'Tower'
|
assert pc['chassis'] == 'Tower'
|
||||||
assert set(e['type'] for e in snapshot['actions']) == {
|
assert set(e['type'] for e in snapshot['actions']) == {
|
||||||
'EreusePrice',
|
|
||||||
'RateComputer',
|
|
||||||
'BenchmarkDataStorage',
|
'BenchmarkDataStorage',
|
||||||
'BenchmarkProcessor',
|
'BenchmarkProcessor',
|
||||||
'BenchmarkProcessorSysbench',
|
'BenchmarkProcessorSysbench',
|
||||||
|
@ -156,7 +148,8 @@ def test_real_hp_11(user: UserClient):
|
||||||
'TestBios',
|
'TestBios',
|
||||||
'VisualTest'
|
'VisualTest'
|
||||||
}
|
}
|
||||||
assert len(list(e['type'] for e in snapshot['actions'])) == 10
|
|
||||||
|
assert len(list(e['type'] for e in snapshot['actions'])) == 8
|
||||||
assert pc['networkSpeeds'] == [1000, None], 'Device has no WiFi'
|
assert pc['networkSpeeds'] == [1000, None], 'Device has no WiFi'
|
||||||
assert pc['processorModel'] == 'intel core i3 cpu 530 @ 2.93ghz'
|
assert pc['processorModel'] == 'intel core i3 cpu 530 @ 2.93ghz'
|
||||||
assert pc['ramSize'] == 8192
|
assert pc['ramSize'] == 8192
|
||||||
|
@ -175,6 +168,7 @@ def test_snapshot_real_eee_1001pxd_with_rate(user: UserClient):
|
||||||
"""Checks the values of the device, components,
|
"""Checks the values of the device, components,
|
||||||
actions and their relationships of a real pc.
|
actions and their relationships of a real pc.
|
||||||
"""
|
"""
|
||||||
|
# import pdb; pdb.set_trace()
|
||||||
s = file('real-eee-1001pxd.snapshot.11')
|
s = file('real-eee-1001pxd.snapshot.11')
|
||||||
snapshot, _ = user.post(res=em.Snapshot, data=s)
|
snapshot, _ = user.post(res=em.Snapshot, data=s)
|
||||||
pc, _ = user.get(res=Device, item=snapshot['device']['devicehubID'])
|
pc, _ = user.get(res=Device, item=snapshot['device']['devicehubID'])
|
||||||
|
@ -186,19 +180,10 @@ def test_snapshot_real_eee_1001pxd_with_rate(user: UserClient):
|
||||||
assert pc['hid'] == 'laptop-asustek_computer_inc-1001pxd-b8oaas048286-14:da:e9:42:f6:7c'
|
assert pc['hid'] == 'laptop-asustek_computer_inc-1001pxd-b8oaas048286-14:da:e9:42:f6:7c'
|
||||||
assert len(pc['tags']) == 1
|
assert len(pc['tags']) == 1
|
||||||
assert pc['networkSpeeds'] == [100, 0], 'Although it has WiFi we do not know the speed'
|
assert pc['networkSpeeds'] == [100, 0], 'Although it has WiFi we do not know the speed'
|
||||||
assert pc['rate']
|
|
||||||
rate = pc['rate']
|
|
||||||
# assert pc['actions'][0]['appearanceRange'] == 'A'
|
# assert pc['actions'][0]['appearanceRange'] == 'A'
|
||||||
# assert pc['actions'][0]['functionalityRange'] == 'B'
|
# assert pc['actions'][0]['functionalityRange'] == 'B'
|
||||||
# TODO add appearance and functionality Range in device[rate]
|
# TODO add appearance and functionality Range in device[rate]
|
||||||
|
|
||||||
assert rate['processorRange'] == 'LOW'
|
|
||||||
assert rate['ramRange'] == 'LOW'
|
|
||||||
assert rate['ratingRange'] == 'LOW'
|
|
||||||
assert rate['ram'] == 1.53
|
|
||||||
# TODO add camelCase instead of snake_case
|
|
||||||
assert rate['dataStorage'] == 3.76
|
|
||||||
assert rate['type'] == 'RateComputer'
|
|
||||||
components = snapshot['components']
|
components = snapshot['components']
|
||||||
wifi = components[0]
|
wifi = components[0]
|
||||||
assert wifi['hid'] == 'networkadapter-qualcomm_atheros-' \
|
assert wifi['hid'] == 'networkadapter-qualcomm_atheros-' \
|
||||||
|
@ -232,7 +217,7 @@ def test_snapshot_real_eee_1001pxd_with_rate(user: UserClient):
|
||||||
assert em.BenchmarkRamSysbench.t in action_types
|
assert em.BenchmarkRamSysbench.t in action_types
|
||||||
assert em.StressTest.t in action_types
|
assert em.StressTest.t in action_types
|
||||||
assert em.Snapshot.t in action_types
|
assert em.Snapshot.t in action_types
|
||||||
assert len(actions) == 8
|
assert len(actions) == 6
|
||||||
gpu = components[3]
|
gpu = components[3]
|
||||||
assert gpu['model'] == 'atom processor d4xx/d5xx/n4xx/n5xx integrated graphics controller'
|
assert gpu['model'] == 'atom processor d4xx/d5xx/n4xx/n5xx integrated graphics controller'
|
||||||
assert gpu['manufacturer'] == 'intel corporation'
|
assert gpu['manufacturer'] == 'intel corporation'
|
||||||
|
@ -242,7 +227,7 @@ def test_snapshot_real_eee_1001pxd_with_rate(user: UserClient):
|
||||||
assert em.BenchmarkRamSysbench.t in action_types
|
assert em.BenchmarkRamSysbench.t in action_types
|
||||||
assert em.StressTest.t in action_types
|
assert em.StressTest.t in action_types
|
||||||
assert em.Snapshot.t in action_types
|
assert em.Snapshot.t in action_types
|
||||||
assert len(action_types) == 6
|
assert len(action_types) == 4
|
||||||
sound = components[4]
|
sound = components[4]
|
||||||
assert sound['model'] == 'nm10/ich7 family high definition audio controller'
|
assert sound['model'] == 'nm10/ich7 family high definition audio controller'
|
||||||
sound = components[5]
|
sound = components[5]
|
||||||
|
@ -264,7 +249,7 @@ def test_snapshot_real_eee_1001pxd_with_rate(user: UserClient):
|
||||||
assert em.TestDataStorage.t in action_types
|
assert em.TestDataStorage.t in action_types
|
||||||
assert em.EraseBasic.t in action_types
|
assert em.EraseBasic.t in action_types
|
||||||
assert em.Snapshot.t in action_types
|
assert em.Snapshot.t in action_types
|
||||||
assert len(action_types) == 9
|
assert len(action_types) == 7
|
||||||
erase = next(e for e in hdd['actions'] if e['type'] == em.EraseBasic.t)
|
erase = next(e for e in hdd['actions'] if e['type'] == em.EraseBasic.t)
|
||||||
assert erase['endTime']
|
assert erase['endTime']
|
||||||
assert erase['startTime']
|
assert erase['startTime']
|
||||||
|
|
Reference in New Issue