adding action moveOn endpoint

This commit is contained in:
Cayo Puigdefabregas 2021-09-06 12:45:47 +02:00
parent f398c50288
commit 74af5add3c
4 changed files with 19 additions and 3 deletions

View File

@ -313,3 +313,8 @@ class MigrateToDef(ActionDef):
class MigrateFromDef(ActionDef):
VIEW = None
SCHEMA = schemas.MigrateFrom
class MoveOnContainerDef(ActionDef):
VIEW = None
SCHEMA = schemas.MoveOnContainer

View File

@ -840,3 +840,10 @@ class MigrateTo(Migrate):
class MigrateFrom(Migrate):
__doc__ = m.MigrateFrom.__doc__
class MoveOnContainer(Migrate):
__doc__ = m.MoveOnContainer.__doc__
weight = Integer()
container_from = NestedOn('TradeDocument', only_query='id')
container_to = NestedOn('TradeDocument', only_query='id')

View File

@ -2478,9 +2478,14 @@ def test_moveonContainer(user: UserClient, user2: UserClient):
user.post(res=models.Action, data=request_trade)
request_moveOn = {
'type': 'MoveOnContainer',
'weight': 15,
'devices': [],
'container_from': tradedocument_from['id'],
'container_to': tradedocument_to['id']
}
import pdb; pdb.set_trace()
doc, _ = user.post(res=models.Action, data=request_moveOn)
assert doc['weight'] == request_moveOn['weight']
assert doc['container_from']['id'] == tradedocument_from['id']
assert doc['container_to']['id'] == tradedocument_to['id']

View File

@ -43,7 +43,6 @@ def test_api_docs(client: Client):
'/documents/wbconf/{wbtype}',
'/documents/internalstats/',
'/documents/stock/',
'/documents/recycle/',
'/documents/check/',
'/documents/lots/',
'/versions/',
@ -123,4 +122,4 @@ def test_api_docs(client: Client):
'scheme': 'basic',
'name': 'Authorization'
}
assert len(docs['definitions']) == 126
assert len(docs['definitions']) == 127