test bug 168

This commit is contained in:
Cayo Puigdefabregas 2021-10-01 18:01:39 +02:00
parent 920937a51f
commit b83bbe25a0

View file

@ -2521,3 +2521,59 @@ def test_moveOnDocument(user: UserClient, user2: UserClient):
assert description == mvs.description assert description == mvs.description
tradedocument_to, _ = user.post(res=TradeDocument, data=request_post2) tradedocument_to, _ = user.post(res=TradeDocument, data=request_post2)
user.post(res=models.Action, data=request_moveOn, status=422) user.post(res=models.Action, data=request_moveOn, status=422)
@pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__)
def test_moveOnDocument_bug168(user: UserClient, user2: UserClient):
"""If you use one moveOnDocument in a trade Document. Next you can not drop this document."""
lotIn, _ = user.post({'name': 'MyLotIn'}, res=Lot)
lotOut, _ = user.post({'name': 'MyLotOut'}, res=Lot)
url = 'http://www.ereuse.org/apapaapaapaapaapaapaapaapaapaapapaapaapaapaapaapaapaapaapaapapaapaapaapaapaapaapaapaapaapaaaa',
request_post1 = {
'filename': 'test.pdf',
'hash': 'bbbbbbbb',
'url': url,
'weight': 150,
'lot': lotIn['id']
}
tradedocument_from, _ = user.post(res=TradeDocument, data=request_post1)
id_hash = 'aaaaaaaaa'
request_post2 = {
'filename': 'test.pdf',
'hash': id_hash,
'url': url,
'weight': 0,
'lot': lotOut['id']
}
tradedocument_to, _ = user.post(res=TradeDocument, data=request_post2)
request_trade = {
'type': 'Trade',
'devices': [],
'userFromEmail': user2.email,
'userToEmail': user.email,
'price': 10,
'date': "2020-12-01T02:00:00+00:00",
'lot': lotIn['id'],
'confirms': True,
}
user.post(res=models.Action, data=request_trade)
description = 'This is a good description'
request_moveOn = {
'type': 'MoveOnDocument',
'weight': 15,
'container_from': tradedocument_from['id'],
'container_to': id_hash,
'description': description
}
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']
import pdb; pdb.set_trace()
tradedocument, _ = user.delete(res=TradeDocument, item=tradedocument_to['id'])