fixing tests
This commit is contained in:
parent
ee70288432
commit
73716a7331
|
@ -228,6 +228,11 @@ class DonateDef(ActionDef):
|
|||
SCHEMA = schemas.Donate
|
||||
|
||||
|
||||
class RentDef(ActionDef):
|
||||
VIEW = None
|
||||
SCHEMA = schemas.Rent
|
||||
|
||||
|
||||
class MakeAvailable(ActionDef):
|
||||
VIEW = None
|
||||
SCHEMA = schemas.MakeAvailable
|
||||
|
|
|
@ -257,10 +257,12 @@ class Device(Thing):
|
|||
and :class:`ereuse_devicehub.resources.action.models.Receive`
|
||||
changes it.
|
||||
"""
|
||||
from ereuse_devicehub.resources.action.models import Receive
|
||||
with suppress(LookupError):
|
||||
action = self.last_action_of(Receive)
|
||||
return action.agent_to
|
||||
pass
|
||||
# TODO @cayop uncomment this lines for link the possessor with the device
|
||||
# from ereuse_devicehub.resources.action.models import Receive
|
||||
# with suppress(LookupError):
|
||||
# action = self.last_action_of(Receive)
|
||||
# return action.agent_to
|
||||
|
||||
@property
|
||||
def working(self):
|
||||
|
|
|
@ -52,6 +52,8 @@ class Device(Thing):
|
|||
price = NestedOn('Price', dump_only=True, description=m.Device.price.__doc__)
|
||||
trading = EnumField(states.Trading, dump_only=True, description=m.Device.trading.__doc__)
|
||||
physical = EnumField(states.Physical, dump_only=True, description=m.Device.physical.__doc__)
|
||||
traking= EnumField(states.Traking, dump_only=True, description=m.Device.physical.__doc__)
|
||||
usage = EnumField(states.Usage, dump_only=True, description=m.Device.physical.__doc__)
|
||||
physical_possessor = NestedOn('Agent', dump_only=True, data_key='physicalPossessor')
|
||||
production_date = DateTime('iso',
|
||||
description=m.Device.updated.comment,
|
||||
|
|
|
@ -72,7 +72,9 @@ class Usage(State):
|
|||
"""Usage states.
|
||||
|
||||
:cvar Allocate: The device is allocate in other Agent (organization, person ...)
|
||||
:cvar Deallocate: The device is deallocate and return to the owner
|
||||
:cvar InUse: The device is being reported to be in active use.
|
||||
"""
|
||||
Allocate = e.Allocate
|
||||
Deallocate = e.Deallocate
|
||||
InUse = e.Live
|
||||
|
|
|
@ -265,7 +265,7 @@ def test_live():
|
|||
assert live['subdivision'] == 'ES-CA'
|
||||
assert live['country'] == 'ES'
|
||||
device, _ = client.get(res=Device, item=live['device']['id'])
|
||||
assert device['physical'] == states.Physical.InUse.name
|
||||
assert device['usage'] == states.Usage.InUse.name
|
||||
|
||||
|
||||
@pytest.mark.mvp
|
||||
|
|
|
@ -100,7 +100,9 @@ def test_api_docs(client: Client):
|
|||
'/videoconferences/{id}/merge/',
|
||||
'/videos/{id}/merge/',
|
||||
'/wireless-access-points/{id}/merge/',
|
||||
'/versions/'
|
||||
'/versions/',
|
||||
'/allocates/',
|
||||
'/deallocates/',
|
||||
}
|
||||
assert docs['info'] == {'title': 'Devicehub', 'version': '0.2'}
|
||||
assert docs['components']['securitySchemes']['bearerAuth'] == {
|
||||
|
@ -111,4 +113,4 @@ def test_api_docs(client: Client):
|
|||
'scheme': 'basic',
|
||||
'name': 'Authorization'
|
||||
}
|
||||
assert len(docs['definitions']) == 122
|
||||
assert len(docs['definitions']) == 123
|
||||
|
|
Reference in a new issue