adding action moveOn endpoint
This commit is contained in:
parent
f398c50288
commit
74af5add3c
|
@ -313,3 +313,8 @@ class MigrateToDef(ActionDef):
|
||||||
class MigrateFromDef(ActionDef):
|
class MigrateFromDef(ActionDef):
|
||||||
VIEW = None
|
VIEW = None
|
||||||
SCHEMA = schemas.MigrateFrom
|
SCHEMA = schemas.MigrateFrom
|
||||||
|
|
||||||
|
|
||||||
|
class MoveOnContainerDef(ActionDef):
|
||||||
|
VIEW = None
|
||||||
|
SCHEMA = schemas.MoveOnContainer
|
||||||
|
|
|
@ -840,3 +840,10 @@ class MigrateTo(Migrate):
|
||||||
|
|
||||||
class MigrateFrom(Migrate):
|
class MigrateFrom(Migrate):
|
||||||
__doc__ = m.MigrateFrom.__doc__
|
__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')
|
||||||
|
|
|
@ -2478,9 +2478,14 @@ def test_moveonContainer(user: UserClient, user2: UserClient):
|
||||||
user.post(res=models.Action, data=request_trade)
|
user.post(res=models.Action, data=request_trade)
|
||||||
|
|
||||||
request_moveOn = {
|
request_moveOn = {
|
||||||
|
'type': 'MoveOnContainer',
|
||||||
'weight': 15,
|
'weight': 15,
|
||||||
|
'devices': [],
|
||||||
'container_from': tradedocument_from['id'],
|
'container_from': tradedocument_from['id'],
|
||||||
'container_to': tradedocument_to['id']
|
'container_to': tradedocument_to['id']
|
||||||
}
|
}
|
||||||
import pdb; pdb.set_trace()
|
|
||||||
doc, _ = user.post(res=models.Action, data=request_moveOn)
|
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']
|
||||||
|
|
|
@ -43,7 +43,6 @@ def test_api_docs(client: Client):
|
||||||
'/documents/wbconf/{wbtype}',
|
'/documents/wbconf/{wbtype}',
|
||||||
'/documents/internalstats/',
|
'/documents/internalstats/',
|
||||||
'/documents/stock/',
|
'/documents/stock/',
|
||||||
'/documents/recycle/',
|
|
||||||
'/documents/check/',
|
'/documents/check/',
|
||||||
'/documents/lots/',
|
'/documents/lots/',
|
||||||
'/versions/',
|
'/versions/',
|
||||||
|
@ -123,4 +122,4 @@ def test_api_docs(client: Client):
|
||||||
'scheme': 'basic',
|
'scheme': 'basic',
|
||||||
'name': 'Authorization'
|
'name': 'Authorization'
|
||||||
}
|
}
|
||||||
assert len(docs['definitions']) == 126
|
assert len(docs['definitions']) == 127
|
||||||
|
|
Reference in New Issue