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