From 3978e606fd70438ecd92ad1c53b2dd6607741bf1 Mon Sep 17 00:00:00 2001 From: Xavier Bustamante Talavera Date: Tue, 23 Oct 2018 16:24:26 +0200 Subject: [PATCH] Add rates to dummy computers --- .../files/asus-eee-1000h.snapshot.11.yaml | 6 +++++ .../files/dell-optiplexgx520.snapshot.11.yaml | 6 +++++ .../dummy/files/nec.snapshot.11.yaml | 6 +++++ .../files/real-eee-1001pxd.snapshot.11.yaml | 6 +++++ .../dummy/files/real-hp.snapshot.11.yaml | 6 +++++ tests/test_workbench.py | 22 +++++++++++++++++-- 6 files changed, 50 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/dummy/files/asus-eee-1000h.snapshot.11.yaml b/ereuse_devicehub/dummy/files/asus-eee-1000h.snapshot.11.yaml index aeda0cc3..5a07c844 100644 --- a/ereuse_devicehub/dummy/files/asus-eee-1000h.snapshot.11.yaml +++ b/ereuse_devicehub/dummy/files/asus-eee-1000h.snapshot.11.yaml @@ -17,6 +17,12 @@ "elapsed": 19, "rate": 19.3106, "type": "BenchmarkRamSysbench" + }, + { + "appearanceRange": "A", + "biosRange": "A", + "functionalityRange": "A", + "type": "WorkbenchRate" } ], "manufacturer": "ASUSTeK Computer INC." diff --git a/ereuse_devicehub/dummy/files/dell-optiplexgx520.snapshot.11.yaml b/ereuse_devicehub/dummy/files/dell-optiplexgx520.snapshot.11.yaml index 2769489e..756e065a 100644 --- a/ereuse_devicehub/dummy/files/dell-optiplexgx520.snapshot.11.yaml +++ b/ereuse_devicehub/dummy/files/dell-optiplexgx520.snapshot.11.yaml @@ -12,6 +12,12 @@ "error": false, "type": "StressTest", "elapsed": 60 + }, + { + "appearanceRange": "A", + "biosRange": "A", + "functionalityRange": "A", + "type": "WorkbenchRate" } ], "type": "Desktop", diff --git a/ereuse_devicehub/dummy/files/nec.snapshot.11.yaml b/ereuse_devicehub/dummy/files/nec.snapshot.11.yaml index 54c645ea..3ad7629f 100644 --- a/ereuse_devicehub/dummy/files/nec.snapshot.11.yaml +++ b/ereuse_devicehub/dummy/files/nec.snapshot.11.yaml @@ -14,6 +14,12 @@ "rate": 0.9323, "elapsed": 1, "type": "BenchmarkRamSysbench" + }, + { + "appearanceRange": "B", + "biosRange": "A", + "functionalityRange": "C", + "type": "WorkbenchRate" } ], "type": "Desktop", diff --git a/ereuse_devicehub/dummy/files/real-eee-1001pxd.snapshot.11.yaml b/ereuse_devicehub/dummy/files/real-eee-1001pxd.snapshot.11.yaml index 47bf9d8f..70d838e2 100644 --- a/ereuse_devicehub/dummy/files/real-eee-1001pxd.snapshot.11.yaml +++ b/ereuse_devicehub/dummy/files/real-eee-1001pxd.snapshot.11.yaml @@ -145,6 +145,12 @@ "type": "StressTest", "error": false, "elapsed": 60 + }, + { + "appearanceRange": "B", + "biosRange": "C", + "functionalityRange": "A", + "type": "WorkbenchRate" } ] }, diff --git a/ereuse_devicehub/dummy/files/real-hp.snapshot.11.yaml b/ereuse_devicehub/dummy/files/real-hp.snapshot.11.yaml index 30b3e122..7288f5e0 100644 --- a/ereuse_devicehub/dummy/files/real-hp.snapshot.11.yaml +++ b/ereuse_devicehub/dummy/files/real-hp.snapshot.11.yaml @@ -148,6 +148,12 @@ "rate": 0.9759, "type": "BenchmarkRamSysbench", "elapsed": 1 + }, + { + "appearanceRange": "B", + "biosRange": "A", + "functionalityRange": "D", + "type": "WorkbenchRate" } ], "serialNumber": "CZC0408YJG", diff --git a/tests/test_workbench.py b/tests/test_workbench.py index f835ce21..1b1b7f2a 100644 --- a/tests/test_workbench.py +++ b/tests/test_workbench.py @@ -142,6 +142,9 @@ def test_real_hp_11(user: UserClient): assert pc['hid'] == 'hewlett-packard-czc0408yjg-hp_compaq_8100_elite_sff' assert pc['chassis'] == 'Tower' assert set(e['type'] for e in snapshot['events']) == { + 'EreusePrice', + 'AggregateRate', + 'WorkbenchRate', 'BenchmarkDataStorage', 'BenchmarkProcessor', 'BenchmarkProcessorSysbench', @@ -149,11 +152,12 @@ def test_real_hp_11(user: UserClient): 'BenchmarkRamSysbench', 'StressTest' } - assert len(list(e['type'] for e in snapshot['events'])) == 6 + assert len(list(e['type'] for e in snapshot['events'])) == 9 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 + # todo check rating def test_real_toshiba_11(user: UserClient): @@ -177,6 +181,20 @@ def test_snapshot_real_eee_1001pxd(user: UserClient): assert pc['hid'] == 'asustek_computer_inc-b8oaas048286-1001pxd' assert pc['tags'] == [] assert pc['networkSpeeds'] == [100, 0], 'Although it has WiFi we do not know the speed' + assert pc['rate'] + rate = pc['rate'] + assert rate['appearanceRange'] == 'B' + assert rate['functionalityRange'] == 'A' + assert rate['processorRange'] == 'VERY_LOW' + assert rate['ramRange'] == 'VERY_LOW' + assert rate['ratingRange'] == 'VERY_LOW' + assert rate['ram'] == 1.53 + assert rate['data_storage'] == 3.76 + assert rate['type'] == 'AggregateRate' + assert rate['biosRange'] == 'C' + assert rate['appearance'] > 0 + assert rate['functionality'] > 0 + assert rate['rating'] > 0 and rate['rating'] != 1 components = snapshot['components'] wifi = components[0] assert wifi['hid'] == 'qualcomm_atheros-74_2f_68_8b_fd_c8-ar9285_wireless_network_adapter' @@ -208,7 +226,7 @@ def test_snapshot_real_eee_1001pxd(user: UserClient): assert em.BenchmarkRamSysbench.t in event_types assert em.StressTest.t in event_types assert em.Snapshot.t in event_types - assert len(events) == 5 + assert len(events) == 7 gpu = components[3] assert gpu['model'] == 'atom processor d4xx/d5xx/n4xx/n5xx integrated graphics controller' assert gpu['manufacturer'] == 'intel corporation'