Add Mixer
This commit is contained in:
parent
048a03801b
commit
0ec06808ce
|
@ -276,6 +276,22 @@ class VideoconferenceDef(VideoDef):
|
|||
SCHEMA = schemas.Videoconference
|
||||
|
||||
|
||||
class CookingDef(DeviceDef):
|
||||
VIEW = None
|
||||
SCHEMA = schemas.Cooking
|
||||
|
||||
def __init__(self, app, import_name=__name__, static_folder=None, static_url_path=None,
|
||||
template_folder=None, url_prefix=None, subdomain=None, url_defaults=None,
|
||||
root_path=None, cli_commands: Iterable[Tuple[Callable, str or None]] = tuple()):
|
||||
super().__init__(app, import_name, static_folder, static_url_path, template_folder,
|
||||
url_prefix, subdomain, url_defaults, root_path, cli_commands)
|
||||
|
||||
|
||||
class Mixer(CookingDef):
|
||||
VIEW = None
|
||||
SCHEMA = schemas.Mixer
|
||||
|
||||
|
||||
class ManufacturerDef(Resource):
|
||||
VIEW = ManufacturerView
|
||||
SCHEMA = schemas.Manufacturer
|
||||
|
|
|
@ -639,6 +639,14 @@ class Videoconference(Video):
|
|||
pass
|
||||
|
||||
|
||||
class Cooking(Device):
|
||||
pass
|
||||
|
||||
|
||||
class Mixer(Cooking):
|
||||
pass
|
||||
|
||||
|
||||
class Manufacturer(db.Model):
|
||||
__table_args__ = {'schema': 'common'}
|
||||
CSV_DELIMITER = csv.get_dialect('excel').delimiter
|
||||
|
|
|
@ -394,6 +394,14 @@ class Videoconference(Video):
|
|||
pass
|
||||
|
||||
|
||||
class Cooking(Device):
|
||||
pass
|
||||
|
||||
|
||||
class Mixer(Cooking):
|
||||
pass
|
||||
|
||||
|
||||
class Manufacturer(Model):
|
||||
CUSTOM_MANUFACTURERS = ... # type: set
|
||||
name = ... # type: Column
|
||||
|
|
|
@ -295,3 +295,11 @@ class VideoScaler(Video):
|
|||
|
||||
class Videoconference(Video):
|
||||
pass
|
||||
|
||||
|
||||
class Cooking(Device):
|
||||
pass
|
||||
|
||||
|
||||
class Mixer(Cooking):
|
||||
pass
|
||||
|
|
|
@ -40,4 +40,4 @@ def test_api_docs(client: Client):
|
|||
'scheme': 'basic',
|
||||
'name': 'Authorization'
|
||||
}
|
||||
assert 92 == len(docs['definitions'])
|
||||
assert 94 == len(docs['definitions'])
|
||||
|
|
|
@ -20,7 +20,8 @@ from ereuse_devicehub.resources.device.exceptions import NeedsId
|
|||
from ereuse_devicehub.resources.device.schemas import Device as DeviceS
|
||||
from ereuse_devicehub.resources.device.sync import MismatchBetweenTags, MismatchBetweenTagsAndHid, \
|
||||
Sync
|
||||
from ereuse_devicehub.resources.enums import ComputerChassis, DisplayTech, Severity
|
||||
from ereuse_devicehub.resources.enums import ComputerChassis, DisplayTech, Severity, \
|
||||
SnapshotSoftware
|
||||
from ereuse_devicehub.resources.event import models as m
|
||||
from ereuse_devicehub.resources.event.models import Remove, Test
|
||||
from ereuse_devicehub.resources.tag.model import Tag
|
||||
|
@ -536,3 +537,30 @@ def test_networking_model():
|
|||
switch = d.Switch(speed=1000, wireless=False)
|
||||
db.session.add(switch)
|
||||
db.session.commit()
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(conftest.app_context.__name__)
|
||||
def test_cooking_mixer():
|
||||
mixer = d.Mixer(serial_number='foo', model='bar', manufacturer='foobar')
|
||||
db.session.add(mixer)
|
||||
db.session.commit()
|
||||
|
||||
|
||||
def test_cooking_mixer_api(user: UserClient):
|
||||
snapshot, _ = user.post(
|
||||
{
|
||||
'type': 'Snapshot',
|
||||
'device': {
|
||||
'serialNumber': 'foo',
|
||||
'model': 'bar',
|
||||
'manufacturer': 'foobar',
|
||||
'type': 'Mixer'
|
||||
},
|
||||
'version': '11.0',
|
||||
'software': SnapshotSoftware.Web.name
|
||||
},
|
||||
res=m.Snapshot
|
||||
)
|
||||
mixer, _ = user.get(res=d.Device, item=snapshot['device']['id'])
|
||||
assert mixer['type'] == 'Mixer'
|
||||
assert mixer['serialNumber'] == 'foo'
|
||||
|
|
Reference in a new issue