test for recycling documents
This commit is contained in:
parent
7e4af161d3
commit
eeb6db7bc2
|
@ -426,6 +426,11 @@ class Ready(ActionWithMultipleDevices):
|
||||||
|
|
||||||
class ActionStatus(ActionWithMultipleDevices):
|
class ActionStatus(ActionWithMultipleDevices):
|
||||||
rol_user = NestedOn(s_user.User, dump_only=True, exclude=('token',))
|
rol_user = NestedOn(s_user.User, dump_only=True, exclude=('token',))
|
||||||
|
documents = NestedOn(s_document.TradeDocument,
|
||||||
|
many=True,
|
||||||
|
required=False, # todo test ensuring len(devices) >= 1
|
||||||
|
only_query='id',
|
||||||
|
collection_class=OrderedSet)
|
||||||
|
|
||||||
@post_load
|
@post_load
|
||||||
def put_rol_user(self, data: dict):
|
def put_rol_user(self, data: dict):
|
||||||
|
|
|
@ -470,6 +470,25 @@ def test_use_changing_owner(user: UserClient, user2: UserClient):
|
||||||
assert device.owner.email == user2.email
|
assert device.owner.email == user2.email
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.mvp
|
||||||
|
@pytest.mark.usefixtures(conftest.app_context.__name__)
|
||||||
|
def test_recycling_container(user: UserClient):
|
||||||
|
lot, _ = user.post({'name': 'MyLotOut'}, res=Lot)
|
||||||
|
url = 'http://www.ereuse.org/',
|
||||||
|
request_post = {
|
||||||
|
'filename': 'test.pdf',
|
||||||
|
'hash': 'bbbbbbbb',
|
||||||
|
'url': url,
|
||||||
|
'weight': 150,
|
||||||
|
'lot': lot['id']
|
||||||
|
}
|
||||||
|
tradedocument, _ = user.post(res=TradeDocument, data=request_post)
|
||||||
|
action = {'type': models.Recycling.t, 'devices': [], 'documents': [tradedocument['id']]}
|
||||||
|
action, _ = user.post(action, res=models.Action)
|
||||||
|
trade = TradeDocument.query.one()
|
||||||
|
assert str(trade.actions[0].id) == action['id']
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
def test_reuse(user: UserClient):
|
def test_reuse(user: UserClient):
|
||||||
snap, _ = user.post(file('basic.snapshot'), res=models.Snapshot)
|
snap, _ = user.post(file('basic.snapshot'), res=models.Snapshot)
|
||||||
|
|
Reference in New Issue