Adding test and fix for Issue 69 EreusePrice Computer type
This commit is contained in:
parent
a7c3ea7317
commit
75b5a4a710
|
@ -1163,6 +1163,7 @@ class EreusePrice(Price):
|
|||
value agreed by a circuit or platform.
|
||||
"""
|
||||
MULTIPLIER = {
|
||||
Computer: 20,
|
||||
Desktop: 20,
|
||||
Laptop: 30
|
||||
}
|
||||
|
@ -1205,7 +1206,7 @@ class EreusePrice(Price):
|
|||
}
|
||||
}
|
||||
}
|
||||
SCHEMA[Server] = SCHEMA[Desktop]
|
||||
SCHEMA[Server] = SCHEMA[Computer] = SCHEMA[Desktop]
|
||||
|
||||
def __init__(self, device, rating_range, role, price: Decimal) -> None:
|
||||
cls = device.__class__ if device.__class__ != Server else Desktop
|
||||
|
|
|
@ -134,6 +134,12 @@ def file(name: str) -> dict:
|
|||
return yaml.load(f)
|
||||
|
||||
|
||||
def file_workbench(name: str) -> dict:
|
||||
"""Opens and parses a YAML file from the ``files`` subdir."""
|
||||
with Path(__file__).parent.joinpath('workbench_files').joinpath(name + '.json').open() as f:
|
||||
return yaml.load(f)
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def tag_id(app: Devicehub) -> str:
|
||||
"""Creates a tag and returns its id."""
|
||||
|
|
|
@ -11,7 +11,7 @@ from ereuse_devicehub.resources.action.models import RateComputer, BenchmarkProc
|
|||
from ereuse_devicehub.resources.device.exceptions import NeedsId
|
||||
from ereuse_devicehub.resources.device.models import Device
|
||||
from ereuse_devicehub.resources.tag.model import Tag
|
||||
from tests.conftest import file
|
||||
from tests.conftest import file, file_workbench
|
||||
|
||||
|
||||
@pytest.mark.mvp
|
||||
|
@ -328,3 +328,8 @@ def test_workbench_asus_1001pxd_rate_low(user: UserClient):
|
|||
def test_david(user: UserClient):
|
||||
s = file('david.lshw.snapshot')
|
||||
snapshot, _ = user.post(res=em.Snapshot, data=s)
|
||||
|
||||
|
||||
def test_eresueprice_computer_type(user: UserClient):
|
||||
s = file_workbench('computer-type.snapshot')
|
||||
snapshot, _ = user.post(res=em.Snapshot, data=s)
|
||||
|
|
Reference in a new issue