This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
devicehub-teal/tests/test_rate.py

42 lines
1.6 KiB
Python
Raw Normal View History

2018-06-10 16:47:49 +00:00
from distutils.version import StrictVersion
import pytest
from ereuse_devicehub.db import db
2018-07-14 14:41:22 +00:00
from ereuse_devicehub.resources.device.models import Computer, Desktop
2018-06-26 13:35:13 +00:00
from ereuse_devicehub.resources.enums import Bios, ComputerChassis, ImageMimeTypes, Orientation, \
RatingSoftware
2018-06-10 16:47:49 +00:00
from ereuse_devicehub.resources.event.models import PhotoboxRate, WorkbenchRate
from ereuse_devicehub.resources.image.models import Image, ImageList
@pytest.mark.usefixtures('auth_app_context')
2018-07-14 14:41:22 +00:00
def test_workbench_rate_db():
2018-06-10 16:47:49 +00:00
rate = WorkbenchRate(processor=0.1,
ram=1.0,
bios=Bios.A,
labelling=False,
graphic_card=0.1,
data_storage=4.1,
2018-07-14 14:41:22 +00:00
software=RatingSoftware.ECost,
version=StrictVersion('1.0'),
2018-06-26 13:35:13 +00:00
device=Computer(serial_number='24', chassis=ComputerChassis.Tower))
2018-06-10 16:47:49 +00:00
db.session.add(rate)
db.session.commit()
@pytest.mark.usefixtures('auth_app_context')
2018-07-14 14:41:22 +00:00
def test_photobox_rate_db():
pc = Desktop(serial_number='24', chassis=ComputerChassis.Tower)
2018-06-10 16:47:49 +00:00
image = Image(name='foo',
content=b'123',
file_format=ImageMimeTypes.jpg,
orientation=Orientation.Horizontal,
image_list=ImageList(device=pc))
rate = PhotoboxRate(image=image,
2018-07-14 14:41:22 +00:00
software=RatingSoftware.ECost,
version=StrictVersion('1.0'),
2018-06-10 16:47:49 +00:00
device=pc)
db.session.add(rate)
db.session.commit()