From 47b7b4224cc4564936c7d0edf4f4647ea1d39c05 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 22 Jan 2021 13:19:29 +0100 Subject: [PATCH] test and fixed bug 1860 --- ereuse_devicehub/resources/action/models.py | 3 ++- tests/test_snapshot.py | 22 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index e34d579a..4f771ed6 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -1193,7 +1193,8 @@ class EreusePrice(Price): MULTIPLIER = { Computer: 20, Desktop: 20, - Laptop: 30 + Laptop: 30, + Server: 40 } class Type: diff --git a/tests/test_snapshot.py b/tests/test_snapshot.py index 902f18ec..c9cf5084 100644 --- a/tests/test_snapshot.py +++ b/tests/test_snapshot.py @@ -371,6 +371,28 @@ def test_snapshot_component_containing_components(user: UserClient): user.post(s, res=Snapshot, status=ValidationError) +@pytest.mark.mvp +def test_ereuse_price(user: UserClient): + """Tests a Snapshot with EraseSectors and the resulting privacy + properties. + + This tests ensures that only the last erasure is picked up, as + erasures have always custom endTime value set. + """ + s = file('erase-sectors.snapshot') + assert s['components'][0]['actions'][0]['endTime'] == '2018-06-01T09:12:06+02:00' + s['device']['type'] = 'Server' + snapshot = snapshot_and_check(user, s, action_types=( + EraseSectors.t, + BenchmarkDataStorage.t, + BenchmarkProcessor.t, + RateComputer.t, + EreusePrice.t + ), perform_second_snapshot=False) + ereuse_price = snapshot['actions'][-1] + assert len(ereuse_price) > 0 + + @pytest.mark.mvp def test_erase_privacy_standards_endtime_sort(user: UserClient): """Tests a Snapshot with EraseSectors and the resulting privacy