test about trade notes
This commit is contained in:
parent
006fe4b855
commit
aaafb2a5fa
|
@ -827,6 +827,7 @@ def test_offer_without_to(user: UserClient):
|
||||||
'code': 'MAX'
|
'code': 'MAX'
|
||||||
}
|
}
|
||||||
user.post(res=models.Action, data=request_post, status=422)
|
user.post(res=models.Action, data=request_post, status=422)
|
||||||
|
trade = models.Trade.query.one()
|
||||||
|
|
||||||
# Check if the new phantom account is reused and not duplicated
|
# Check if the new phantom account is reused and not duplicated
|
||||||
computer = file('1-device-with-components.snapshot')
|
computer = file('1-device-with-components.snapshot')
|
||||||
|
@ -960,6 +961,7 @@ def test_offer(user: UserClient):
|
||||||
assert device.owner.email == user.email
|
assert device.owner.email == user.email
|
||||||
assert device.owner.email != user2.email
|
assert device.owner.email != user2.email
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
@pytest.mark.usefixtures(conftest.app_context.__name__)
|
@pytest.mark.usefixtures(conftest.app_context.__name__)
|
||||||
def test_offer_without_devices(user: UserClient):
|
def test_offer_without_devices(user: UserClient):
|
||||||
|
@ -984,6 +986,38 @@ def test_offer_without_devices(user: UserClient):
|
||||||
user.post(res=models.Action, data=request_post)
|
user.post(res=models.Action, data=request_post)
|
||||||
# no there are transfer of devices
|
# no there are transfer of devices
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.mvp
|
||||||
|
@pytest.mark.usefixtures(conftest.app_context.__name__)
|
||||||
|
def test_automatic_note_to_trade(user: UserClient, user2: UserClient):
|
||||||
|
"""Check than there are one note when one device is insert in one trade lot"""
|
||||||
|
lot, _ = user.post({'name': 'MyLot'}, res=Lot)
|
||||||
|
request_post = {
|
||||||
|
'type': 'Trade',
|
||||||
|
'devices': [],
|
||||||
|
'userFrom': user.email,
|
||||||
|
'userTo': user2.email,
|
||||||
|
'price': 10,
|
||||||
|
'date': "2020-12-01T02:00:00+00:00",
|
||||||
|
'documentID': '1',
|
||||||
|
'lot': lot['id'],
|
||||||
|
'confirm': True,
|
||||||
|
}
|
||||||
|
|
||||||
|
user.post(res=models.Action, data=request_post)
|
||||||
|
trade = models.Trade.query.one()
|
||||||
|
assert trade.notes == []
|
||||||
|
|
||||||
|
snapshot, _ = user.post(file('basic.snapshot'), res=models.Snapshot)
|
||||||
|
device = Device.query.filter_by(id=snapshot['device']['id']).one()
|
||||||
|
lot, _ = user.post({},
|
||||||
|
res=Lot,
|
||||||
|
item='{}/devices'.format(lot['id']),
|
||||||
|
query=[('id', device.id)])
|
||||||
|
assert len(trade.notes) == 1
|
||||||
|
assert trade.notes[0].device_id == device.id
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
@pytest.mark.usefixtures(conftest.auth_app_context.__name__)
|
@pytest.mark.usefixtures(conftest.auth_app_context.__name__)
|
||||||
def test_price_custom():
|
def test_price_custom():
|
||||||
|
|
Reference in New Issue