test revoke and confirm with doble query

This commit is contained in:
Cayo Puigdefabregas 2021-04-27 10:53:19 +02:00
parent 77ddb79d64
commit 330f2b7b78
1 changed files with 9 additions and 6 deletions

View File

@ -1166,12 +1166,13 @@ def test_endpoint_confirm(user: UserClient, user2: UserClient):
} }
user2.post(res=models.Action, data=request_confirm) user2.post(res=models.Action, data=request_confirm)
user2.post(res=models.Action, data=request_confirm, status=422)
assert len(trade.acceptances) == 2
@pytest.mark.mvp @pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__) @pytest.mark.usefixtures(conftest.app_context.__name__)
def test_confirm_revoke(user: UserClient, user2: UserClient): def test_confirm_revoke(user: UserClient, user2: UserClient):
"""Check the normal revoke one confirmation""" """Check the normal revoke one confirmation"""
# import pdb; pdb.set_trace()
lot, _ = user.post({'name': 'MyLot'}, res=Lot) lot, _ = user.post({'name': 'MyLot'}, res=Lot)
request_post = { request_post = {
'type': 'Trade', 'type': 'Trade',
@ -1194,15 +1195,17 @@ def test_confirm_revoke(user: UserClient, user2: UserClient):
'devices': [] 'devices': []
} }
confirm, _ = user2.post(res=models.Action, data=request_confirm) user2.post(res=models.Action, data=request_confirm)
request_revoke = { request_revoke = {
'type': 'Confirm', 'type': 'Confirm',
'action': confirm['id'], 'action': trade.id,
'devices': [], 'devices': [],
'revoke': True, 'revoke': True,
} }
# import pdb; pdb.set_trace() user2.post(res=models.Action, data=request_revoke)
confirm2, _ = user2.post(res=models.Action, data=request_revoke) user2.post(res=models.Action, data=request_revoke, status=422)
confirm2, _ = user.post(res=models.Action, data=request_revoke, status=422) assert len(trade.acceptances) == 3
user2.post(res=models.Action, data=request_confirm)
assert len(trade.acceptances) == 4