rebuild trading function
This commit is contained in:
parent
cef22f01ce
commit
872a0be866
|
@ -147,10 +147,7 @@ class Metrics(MetricsMix):
|
||||||
if the action is one trade action, is possible than have a list of confirmations.
|
if the action is one trade action, is possible than have a list of confirmations.
|
||||||
Get the doble confirm for to know if this trade is confirmed or not.
|
Get the doble confirm for to know if this trade is confirmed or not.
|
||||||
"""
|
"""
|
||||||
# import pdb; pdb.set_trace()
|
return self.device.trading(self.act.lot)
|
||||||
if self.device.trading(self.act.lot) == 'TradeConfirmed':
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def get_trade(self):
|
def get_trade(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -330,6 +330,81 @@ class Device(Thing):
|
||||||
5: 'NeedConfirmRevoke',
|
5: 'NeedConfirmRevoke',
|
||||||
6: 'RevokeConfirmed'}
|
6: 'RevokeConfirmed'}
|
||||||
|
|
||||||
|
trade = lot.trade
|
||||||
|
user_from = trade.user_from
|
||||||
|
user_to = trade.user_to
|
||||||
|
status = 0
|
||||||
|
last_user = None
|
||||||
|
|
||||||
|
if not hasattr(trade, 'acceptances'):
|
||||||
|
return Status[status]
|
||||||
|
|
||||||
|
for ac in self.actions:
|
||||||
|
if ac.t not in ['Confirm', 'Revoke']:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if ac.user not in [user_from, user_to]:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if ac.t == 'Confirm' and ac.action == trade:
|
||||||
|
if status in [0, 6]:
|
||||||
|
status = 1
|
||||||
|
last_user = ac.user
|
||||||
|
if ac.user == user_from and user_to == g.user:
|
||||||
|
status = 2
|
||||||
|
if ac.user == user_to and user_from == g.user:
|
||||||
|
status = 2
|
||||||
|
continue
|
||||||
|
|
||||||
|
if status in [1, 2]:
|
||||||
|
if last_user != ac.user:
|
||||||
|
status = 3
|
||||||
|
last_user = ac.user
|
||||||
|
continue
|
||||||
|
|
||||||
|
if status in [4, 5]:
|
||||||
|
status = 3
|
||||||
|
last_user = ac.user
|
||||||
|
continue
|
||||||
|
|
||||||
|
if ac.t == 'Revoke' and ac.action == trade:
|
||||||
|
if status == 3:
|
||||||
|
status = 4
|
||||||
|
last_user = ac.user
|
||||||
|
if ac.user == user_from and user_to == g.user:
|
||||||
|
status = 5
|
||||||
|
if ac.user == user_to and user_from == g.user:
|
||||||
|
status = 5
|
||||||
|
continue
|
||||||
|
|
||||||
|
if status in [4, 5]:
|
||||||
|
if last_user != ac.user:
|
||||||
|
status = 6
|
||||||
|
last_user = ac.user
|
||||||
|
continue
|
||||||
|
|
||||||
|
if status in [1, 2]:
|
||||||
|
status = 6
|
||||||
|
last_user = ac.user
|
||||||
|
continue
|
||||||
|
|
||||||
|
return Status[status]
|
||||||
|
|
||||||
|
def trading_for_web2(self, lot):
|
||||||
|
"""The trading state, or None if no Trade action has
|
||||||
|
ever been performed to this device. This extract the posibilities for to do.
|
||||||
|
This method is performed for show in the web."""
|
||||||
|
if not hasattr(lot, 'trade'):
|
||||||
|
return
|
||||||
|
|
||||||
|
Status = {0: 'Trade',
|
||||||
|
1: 'Confirm',
|
||||||
|
2: 'NeedConfirmation',
|
||||||
|
3: 'TradeConfirmed',
|
||||||
|
4: 'Revoke',
|
||||||
|
5: 'NeedConfirmRevoke',
|
||||||
|
6: 'RevokeConfirmed'}
|
||||||
|
|
||||||
trade = lot.trade
|
trade = lot.trade
|
||||||
user_from = trade.user_from
|
user_from = trade.user_from
|
||||||
user_to = trade.user_to
|
user_to = trade.user_to
|
||||||
|
@ -353,7 +428,6 @@ class Device(Thing):
|
||||||
if ac.t == 'Confirm' and ac.action == trade:
|
if ac.t == 'Confirm' and ac.action == trade:
|
||||||
if ac.user == user_from:
|
if ac.user == user_from:
|
||||||
user_from_confirm = True
|
user_from_confirm = True
|
||||||
# import pdb; pdb.set_trace()
|
|
||||||
last_action['confirm'] = time.mktime(ac.created.timetuple())
|
last_action['confirm'] = time.mktime(ac.created.timetuple())
|
||||||
user_from_revoke, user_to_revoke = False, False
|
user_from_revoke, user_to_revoke = False, False
|
||||||
elif ac.user == user_to:
|
elif ac.user == user_to:
|
||||||
|
@ -398,24 +472,22 @@ class Device(Thing):
|
||||||
|
|
||||||
def trading(self, lot):
|
def trading(self, lot):
|
||||||
"""The trading state, or None if no Trade action has
|
"""The trading state, or None if no Trade action has
|
||||||
ever been performed to this device. This extract the posibilities for to do"""
|
ever been performed to this device. This extract the posibilities for to do.
|
||||||
|
This method is performed for show in the web."""
|
||||||
if not hasattr(lot, 'trade'):
|
if not hasattr(lot, 'trade'):
|
||||||
return
|
return
|
||||||
|
|
||||||
Status = {0: 'Trade',
|
Status = {0: 'Trade',
|
||||||
1: 'Confirm',
|
2: 'NeedConfirmation',
|
||||||
2: 'TradeConfirmed',
|
3: 'TradeConfirmed',
|
||||||
3: 'Revoke',
|
5: 'NeedConfirmRevoke',
|
||||||
4: 'RevokeConfirmed'}
|
6: 'RevokeConfirmed'}
|
||||||
|
|
||||||
trade = lot.trade
|
trade = lot.trade
|
||||||
user_from = trade.user_from
|
user_from = trade.user_from
|
||||||
user_to = trade.user_to
|
user_to = trade.user_to
|
||||||
user_from_confirm = False
|
|
||||||
user_to_confirm = False
|
|
||||||
user_from_revoke = False
|
|
||||||
user_to_revoke = False
|
|
||||||
status = 0
|
status = 0
|
||||||
|
last_user = None
|
||||||
|
|
||||||
if not hasattr(trade, 'acceptances'):
|
if not hasattr(trade, 'acceptances'):
|
||||||
return Status[status]
|
return Status[status]
|
||||||
|
@ -428,29 +500,38 @@ class Device(Thing):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if ac.t == 'Confirm' and ac.action == trade:
|
if ac.t == 'Confirm' and ac.action == trade:
|
||||||
if ac.user == user_from:
|
if status in [0, 6]:
|
||||||
user_from_confirm = True
|
status = 2
|
||||||
elif ac.user == user_to:
|
last_user = ac.user
|
||||||
user_to_confirm = True
|
continue
|
||||||
|
|
||||||
|
if status == 2:
|
||||||
|
if last_user != ac.user:
|
||||||
|
status = 3
|
||||||
|
last_user = ac.user
|
||||||
|
continue
|
||||||
|
|
||||||
|
if status == 5:
|
||||||
|
status = 3
|
||||||
|
last_user = ac.user
|
||||||
|
continue
|
||||||
|
|
||||||
if ac.t == 'Revoke' and ac.action == trade:
|
if ac.t == 'Revoke' and ac.action == trade:
|
||||||
if ac.user == user_from:
|
if status == 3:
|
||||||
user_from_revoke = True
|
status = 5
|
||||||
elif ac.user == user_to:
|
last_user = ac.user
|
||||||
user_to_revoke = True
|
continue
|
||||||
|
|
||||||
confirms = [user_from_confirm, user_to_confirm]
|
if status == 5:
|
||||||
revokes = [user_from_revoke, user_to_revoke]
|
if last_user != ac.user:
|
||||||
|
status = 6
|
||||||
|
last_user = ac.user
|
||||||
|
continue
|
||||||
|
|
||||||
if any(confirms):
|
if status == 2:
|
||||||
status = 1
|
status = 6
|
||||||
if all(confirms):
|
last_user = ac.user
|
||||||
status = 2
|
continue
|
||||||
|
|
||||||
if any(revokes):
|
|
||||||
status = 3
|
|
||||||
if all(revokes):
|
|
||||||
status = 4
|
|
||||||
|
|
||||||
return Status[status]
|
return Status[status]
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,6 @@ def delete_from_trade(lot: Lot, devices: List):
|
||||||
|
|
||||||
drop_of_lot = []
|
drop_of_lot = []
|
||||||
without_confirms = []
|
without_confirms = []
|
||||||
# import pdb; pdb.set_trace()
|
|
||||||
for dev in devices:
|
for dev in devices:
|
||||||
if dev.trading_for_web(lot) in ['NeedConfirmation', 'Confirm', 'NeedConfirmRevoke']:
|
if dev.trading_for_web(lot) in ['NeedConfirmation', 'Confirm', 'NeedConfirmRevoke']:
|
||||||
drop_of_lot.append(dev)
|
drop_of_lot.append(dev)
|
||||||
|
|
|
@ -328,7 +328,7 @@ def test_outgoinlot_status_actions(action_model: models.Action, user: UserClient
|
||||||
|
|
||||||
assert device['actions'][-1]['id'] == action['id']
|
assert device['actions'][-1]['id'] == action['id']
|
||||||
assert action['author']['id'] == user.user['id']
|
assert action['author']['id'] == user.user['id']
|
||||||
assert action['rol_user']['id'] == user.user['id']
|
assert action['rol_user']['id'] == user2.user['id']
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
|
@ -386,14 +386,14 @@ def test_history_status_actions(user: UserClient, user2: UserClient):
|
||||||
assert action['id'] == str(device.status.id)
|
assert action['id'] == str(device.status.id)
|
||||||
assert device.status.t == models.Recycling.t
|
assert device.status.t == models.Recycling.t
|
||||||
assert [action['id']] == [str(ac.id) for ac in device.history_status]
|
assert [action['id']] == [str(ac.id) for ac in device.history_status]
|
||||||
|
|
||||||
# Case 2
|
# Case 2
|
||||||
action2 = {'type': models.Refurbish.t, 'devices': [device.id]}
|
action2 = {'type': models.Refurbish.t, 'devices': [device.id]}
|
||||||
action2, _ = user.post(action2, res=models.Action)
|
action2, _ = user.post(action2, res=models.Action)
|
||||||
assert action2['id'] == str(device.status.id)
|
assert action2['id'] == str(device.status.id)
|
||||||
assert device.status.t == models.Refurbish.t
|
assert device.status.t == models.Refurbish.t
|
||||||
assert [action2['id']] == [str(ac.id) for ac in device.history_status]
|
assert [action2['id']] == [str(ac.id) for ac in device.history_status]
|
||||||
|
|
||||||
# Case 3
|
# Case 3
|
||||||
lot, _ = user.post({'name': 'MyLot'}, res=Lot)
|
lot, _ = user.post({'name': 'MyLot'}, res=Lot)
|
||||||
user.post({},
|
user.post({},
|
||||||
|
@ -1709,7 +1709,6 @@ def test_confirmRevoke(user: UserClient, user2: UserClient):
|
||||||
assert len(trade.devices) == 10
|
assert len(trade.devices) == 10
|
||||||
|
|
||||||
# the SCRAP confirms the revoke action
|
# the SCRAP confirms the revoke action
|
||||||
import pdb; pdb.set_trace()
|
|
||||||
request_confirm_revoke = {
|
request_confirm_revoke = {
|
||||||
'type': 'ConfirmRevoke',
|
'type': 'ConfirmRevoke',
|
||||||
'action': device_10.actions[-2].id,
|
'action': device_10.actions[-2].id,
|
||||||
|
@ -1754,7 +1753,7 @@ def test_trade_case1(user: UserClient, user2: UserClient):
|
||||||
item='{}/devices'.format(lot['id']),
|
item='{}/devices'.format(lot['id']),
|
||||||
query=devices[:-1])
|
query=devices[:-1])
|
||||||
|
|
||||||
# the manager shares the temporary lot with the SCRAP as an incoming lot
|
# the manager shares the temporary lot with the SCRAP as an incoming lot
|
||||||
# for the CRAP to confirm it
|
# for the CRAP to confirm it
|
||||||
request_post = {
|
request_post = {
|
||||||
'type': 'Trade',
|
'type': 'Trade',
|
||||||
|
@ -1770,31 +1769,23 @@ def test_trade_case1(user: UserClient, user2: UserClient):
|
||||||
user.post(res=models.Action, data=request_post)
|
user.post(res=models.Action, data=request_post)
|
||||||
trade = models.Trade.query.one()
|
trade = models.Trade.query.one()
|
||||||
|
|
||||||
lot, _ = user.post({},
|
lot = trade.lot
|
||||||
res=Lot,
|
device = trade.devices[0]
|
||||||
item='{}/devices'.format(lot['id']),
|
|
||||||
query=devices[-1:])
|
|
||||||
|
|
||||||
device1, device2 = trade.devices
|
assert device.actions[-2].t == 'Trade'
|
||||||
|
assert device.actions[-1].t == 'Confirm'
|
||||||
|
assert device.actions[-1].user == trade.user_to
|
||||||
|
|
||||||
assert device1.actions[-2].t == 'Trade'
|
user.delete({},
|
||||||
assert device1.actions[-1].t == 'Confirm'
|
res=Lot,
|
||||||
assert device1.actions[-1].user == trade.user_to
|
item='{}/devices'.format(lot.id),
|
||||||
assert device2.actions[-2].t == 'Trade'
|
query=devices[:-1], status=200)
|
||||||
assert device2.actions[-1].t == 'Confirm'
|
|
||||||
assert device2.actions[-1].user == trade.user_to
|
|
||||||
|
|
||||||
lot, _ = user.delete({},
|
assert device not in trade.lot.devices
|
||||||
res=Lot,
|
assert device.trading_for_web(trade.lot) == 'RevokeConfirmed'
|
||||||
item='{}/devices'.format(lot['id']),
|
assert device.actions[-2].t == 'Confirm'
|
||||||
query=devices, status=200)
|
assert device.actions[-1].t == 'Revoke'
|
||||||
|
assert device.actions[-1].user == trade.user_to
|
||||||
assert device1.actions[-2].t == 'Revoke'
|
|
||||||
assert device1.actions[-1].t == 'ConfirmRevoke'
|
|
||||||
assert device1.actions[-1].user == trade.user_to
|
|
||||||
assert device2.actions[-2].t == 'Revoke'
|
|
||||||
assert device2.actions[-1].t == 'ConfirmRevoke'
|
|
||||||
assert device2.actions[-1].user == trade.user_to
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
|
@ -1837,6 +1828,7 @@ def test_trade_case2(user: UserClient, user2: UserClient):
|
||||||
|
|
||||||
device1, device2 = trade.devices
|
device1, device2 = trade.devices
|
||||||
|
|
||||||
|
# import pdb; pdb.set_trace()
|
||||||
assert device1.actions[-2].t == 'Trade'
|
assert device1.actions[-2].t == 'Trade'
|
||||||
assert device1.actions[-1].t == 'Confirm'
|
assert device1.actions[-1].t == 'Confirm'
|
||||||
assert device1.actions[-1].user == trade.user_to
|
assert device1.actions[-1].user == trade.user_to
|
||||||
|
@ -1853,12 +1845,13 @@ def test_trade_case2(user: UserClient, user2: UserClient):
|
||||||
# Normal revoke
|
# Normal revoke
|
||||||
user.post(res=models.Action, data=request_revoke)
|
user.post(res=models.Action, data=request_revoke)
|
||||||
|
|
||||||
assert device1.actions[-2].t == 'Revoke'
|
assert device1.actions[-2].t == 'Confirm'
|
||||||
assert device1.actions[-1].t == 'ConfirmRevoke'
|
assert device1.actions[-1].t == 'Revoke'
|
||||||
assert device1.actions[-1].user == trade.user_to
|
assert device1.actions[-1].user == trade.user_to
|
||||||
assert device2.actions[-2].t == 'Revoke'
|
assert device2.actions[-2].t == 'Confirm'
|
||||||
assert device2.actions[-1].t == 'ConfirmRevoke'
|
assert device2.actions[-1].t == 'Revoke'
|
||||||
assert device2.actions[-1].user == trade.user_to
|
assert device2.actions[-1].user == trade.user_to
|
||||||
|
assert device1.trading_for_web(trade.lot) == 'RevokeConfirmed'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
|
@ -1866,7 +1859,6 @@ def test_trade_case2(user: UserClient, user2: UserClient):
|
||||||
def test_trade_case3(user: UserClient, user2: UserClient):
|
def test_trade_case3(user: UserClient, user2: UserClient):
|
||||||
# the pRp (manatest_usecase_confirmationger) creates a temporary lot
|
# the pRp (manatest_usecase_confirmationger) creates a temporary lot
|
||||||
lot, _ = user.post({'name': 'MyLot'}, res=Lot)
|
lot, _ = user.post({'name': 'MyLot'}, res=Lot)
|
||||||
# The manager add 7 device into the lot
|
|
||||||
snap1, _ = user.post(file('basic.snapshot'), res=models.Snapshot)
|
snap1, _ = user.post(file('basic.snapshot'), res=models.Snapshot)
|
||||||
snap2, _ = user2.post(file('acer.happy.battery.snapshot'), res=models.Snapshot)
|
snap2, _ = user2.post(file('acer.happy.battery.snapshot'), res=models.Snapshot)
|
||||||
|
|
||||||
|
@ -1878,7 +1870,7 @@ def test_trade_case3(user: UserClient, user2: UserClient):
|
||||||
item='{}/devices'.format(lot['id']),
|
item='{}/devices'.format(lot['id']),
|
||||||
query=devices[:-1])
|
query=devices[:-1])
|
||||||
|
|
||||||
# the manager shares the temporary lot with the SCRAP as an incoming lot
|
# the manager shares the temporary lot with the SCRAP as an incoming lot
|
||||||
# for the CRAP to confirm it
|
# for the CRAP to confirm it
|
||||||
request_post = {
|
request_post = {
|
||||||
'type': 'Trade',
|
'type': 'Trade',
|
||||||
|
@ -1913,9 +1905,10 @@ def test_trade_case3(user: UserClient, user2: UserClient):
|
||||||
item='{}/devices'.format(lot['id']),
|
item='{}/devices'.format(lot['id']),
|
||||||
query=devices[-1:], status=200)
|
query=devices[-1:], status=200)
|
||||||
|
|
||||||
assert device2.actions[-2].t == 'Revoke'
|
assert device2.actions[-2].t == 'Confirm'
|
||||||
assert device2.actions[-1].t == 'ConfirmRevoke'
|
assert device2.actions[-1].t == 'Revoke'
|
||||||
assert device2.actions[-1].user == trade.user_from
|
assert device2.actions[-1].user == trade.user_from
|
||||||
|
assert device2.trading_for_web(trade.lot) == 'RevokeConfirmed'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
|
@ -1977,9 +1970,10 @@ def test_trade_case4(user: UserClient, user2: UserClient):
|
||||||
assert device1.actions[-2].t == 'Trade'
|
assert device1.actions[-2].t == 'Trade'
|
||||||
assert device1.actions[-1].t == 'Confirm'
|
assert device1.actions[-1].t == 'Confirm'
|
||||||
assert device1.actions[-1].user == trade.user_to
|
assert device1.actions[-1].user == trade.user_to
|
||||||
assert device2.actions[-2].t == 'Revoke'
|
assert device2.actions[-2].t == 'Confirm'
|
||||||
assert device2.actions[-1].t == 'ConfirmRevoke'
|
assert device2.actions[-1].t == 'Revoke'
|
||||||
assert device2.actions[-1].user == trade.user_from
|
assert device2.actions[-1].user == trade.user_from
|
||||||
|
assert device2.trading_for_web(trade.lot) == 'RevokeConfirmed'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
|
@ -2034,8 +2028,8 @@ def test_trade_case5(user: UserClient, user2: UserClient):
|
||||||
assert device2.actions[-1].user == trade.user_from
|
assert device2.actions[-1].user == trade.user_from
|
||||||
|
|
||||||
request_confirm_revoke = {
|
request_confirm_revoke = {
|
||||||
'type': 'ConfirmRevoke',
|
'type': 'Revoke',
|
||||||
'action': device2.actions[-1].id,
|
'action': trade.id,
|
||||||
'devices': [device2.id],
|
'devices': [device2.id],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2043,8 +2037,9 @@ def test_trade_case5(user: UserClient, user2: UserClient):
|
||||||
user.post(res=models.Action, data=request_confirm_revoke)
|
user.post(res=models.Action, data=request_confirm_revoke)
|
||||||
|
|
||||||
assert device2.actions[-2].t == 'Revoke'
|
assert device2.actions[-2].t == 'Revoke'
|
||||||
assert device2.actions[-1].t == 'ConfirmRevoke'
|
assert device2.actions[-1].t == 'Revoke'
|
||||||
assert device2.actions[-1].user == trade.user_to
|
assert device2.actions[-1].user == trade.user_to
|
||||||
|
assert device2.trading_for_web(trade.lot) == 'RevokeConfirmed'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
|
@ -2104,8 +2099,8 @@ def test_trade_case6(user: UserClient, user2: UserClient):
|
||||||
assert device2.actions[-1].user == trade.user_to
|
assert device2.actions[-1].user == trade.user_to
|
||||||
|
|
||||||
request_confirm_revoke = {
|
request_confirm_revoke = {
|
||||||
'type': 'ConfirmRevoke',
|
'type': 'Revoke',
|
||||||
'action': device2.actions[-1].id,
|
'action': trade.id,
|
||||||
'devices': [device2.id],
|
'devices': [device2.id],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2113,8 +2108,9 @@ def test_trade_case6(user: UserClient, user2: UserClient):
|
||||||
user2.post(res=models.Action, data=request_confirm_revoke)
|
user2.post(res=models.Action, data=request_confirm_revoke)
|
||||||
|
|
||||||
assert device2.actions[-2].t == 'Revoke'
|
assert device2.actions[-2].t == 'Revoke'
|
||||||
assert device2.actions[-1].t == 'ConfirmRevoke'
|
assert device2.actions[-1].t == 'Revoke'
|
||||||
assert device2.actions[-1].user == trade.user_from
|
assert device2.actions[-1].user == trade.user_from
|
||||||
|
assert device2.trading_for_web(trade.lot) == 'RevokeConfirmed'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
|
@ -2156,6 +2152,7 @@ def test_trade_case7(user: UserClient, user2: UserClient):
|
||||||
|
|
||||||
# Normal revoke
|
# Normal revoke
|
||||||
user2.post(res=models.Action, data=request_confirm)
|
user2.post(res=models.Action, data=request_confirm)
|
||||||
|
assert device.trading_for_web(trade.lot) == 'TradeConfirmed'
|
||||||
|
|
||||||
lot, _ = user.delete({},
|
lot, _ = user.delete({},
|
||||||
res=Lot,
|
res=Lot,
|
||||||
|
@ -2163,14 +2160,14 @@ def test_trade_case7(user: UserClient, user2: UserClient):
|
||||||
query=devices, status=200)
|
query=devices, status=200)
|
||||||
|
|
||||||
request_confirm_revoke = {
|
request_confirm_revoke = {
|
||||||
'type': 'ConfirmRevoke',
|
'type': 'Revoke',
|
||||||
'action': device.actions[-1].id,
|
'action': trade.id,
|
||||||
'devices': [device.id],
|
'devices': [device.id],
|
||||||
}
|
}
|
||||||
|
|
||||||
user2.post(res=models.Action, data=request_confirm_revoke)
|
user2.post(res=models.Action, data=request_confirm_revoke)
|
||||||
|
|
||||||
assert device.actions[-1].t == 'ConfirmRevoke'
|
assert device.actions[-1].t == 'Revoke'
|
||||||
assert device.actions[-1].user == trade.user_from
|
assert device.actions[-1].user == trade.user_from
|
||||||
assert device.actions[-2].t == 'Revoke'
|
assert device.actions[-2].t == 'Revoke'
|
||||||
assert device.actions[-2].user == trade.user_to
|
assert device.actions[-2].user == trade.user_to
|
||||||
|
@ -2180,6 +2177,7 @@ def test_trade_case7(user: UserClient, user2: UserClient):
|
||||||
assert device.actions[-4].user == trade.user_to
|
assert device.actions[-4].user == trade.user_to
|
||||||
assert device.actions[-5].t == 'Trade'
|
assert device.actions[-5].t == 'Trade'
|
||||||
assert device.actions[-5].author == trade.user_to
|
assert device.actions[-5].author == trade.user_to
|
||||||
|
assert device.trading_for_web(trade.lot) == 'RevokeConfirmed'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
|
@ -2221,6 +2219,7 @@ def test_trade_case8(user: UserClient, user2: UserClient):
|
||||||
|
|
||||||
# Normal revoke
|
# Normal revoke
|
||||||
user2.post(res=models.Action, data=request_confirm)
|
user2.post(res=models.Action, data=request_confirm)
|
||||||
|
assert device.trading_for_web(trade.lot) == 'TradeConfirmed'
|
||||||
|
|
||||||
request_revoke = {
|
request_revoke = {
|
||||||
'type': 'Revoke',
|
'type': 'Revoke',
|
||||||
|
@ -2232,14 +2231,14 @@ def test_trade_case8(user: UserClient, user2: UserClient):
|
||||||
user.post(res=models.Action, data=request_revoke)
|
user.post(res=models.Action, data=request_revoke)
|
||||||
|
|
||||||
request_confirm_revoke = {
|
request_confirm_revoke = {
|
||||||
'type': 'ConfirmRevoke',
|
'type': 'Revoke',
|
||||||
'action': device.actions[-1].id,
|
'action': trade.id,
|
||||||
'devices': [device.id],
|
'devices': [device.id],
|
||||||
}
|
}
|
||||||
|
|
||||||
user2.post(res=models.Action, data=request_confirm_revoke)
|
user2.post(res=models.Action, data=request_confirm_revoke)
|
||||||
|
|
||||||
assert device.actions[-1].t == 'ConfirmRevoke'
|
assert device.actions[-1].t == 'Revoke'
|
||||||
assert device.actions[-1].user == trade.user_from
|
assert device.actions[-1].user == trade.user_from
|
||||||
assert device.actions[-2].t == 'Revoke'
|
assert device.actions[-2].t == 'Revoke'
|
||||||
assert device.actions[-2].user == trade.user_to
|
assert device.actions[-2].user == trade.user_to
|
||||||
|
@ -2249,6 +2248,7 @@ def test_trade_case8(user: UserClient, user2: UserClient):
|
||||||
assert device.actions[-4].user == trade.user_to
|
assert device.actions[-4].user == trade.user_to
|
||||||
assert device.actions[-5].t == 'Trade'
|
assert device.actions[-5].t == 'Trade'
|
||||||
assert device.actions[-5].author == trade.user_to
|
assert device.actions[-5].author == trade.user_to
|
||||||
|
assert device.trading_for_web(trade.lot) == 'RevokeConfirmed'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
|
@ -2301,6 +2301,7 @@ def test_trade_case9(user: UserClient, user2: UserClient):
|
||||||
|
|
||||||
# Normal revoke
|
# Normal revoke
|
||||||
user.post(res=models.Action, data=request_confirm)
|
user.post(res=models.Action, data=request_confirm)
|
||||||
|
assert device.trading_for_web(trade.lot) == 'TradeConfirmed'
|
||||||
|
|
||||||
assert device.owner == trade.user_to
|
assert device.owner == trade.user_to
|
||||||
|
|
||||||
|
@ -2310,8 +2311,8 @@ def test_trade_case9(user: UserClient, user2: UserClient):
|
||||||
query=devices[-1:], status=200)
|
query=devices[-1:], status=200)
|
||||||
|
|
||||||
request_confirm_revoke = {
|
request_confirm_revoke = {
|
||||||
'type': 'ConfirmRevoke',
|
'type': 'Revoke',
|
||||||
'action': device.actions[-1].id,
|
'action': trade.id,
|
||||||
'devices': [device.id],
|
'devices': [device.id],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2319,7 +2320,7 @@ def test_trade_case9(user: UserClient, user2: UserClient):
|
||||||
|
|
||||||
assert device.owner == trade.user_from
|
assert device.owner == trade.user_from
|
||||||
|
|
||||||
assert device.actions[-1].t == 'ConfirmRevoke'
|
assert device.actions[-1].t == 'Revoke'
|
||||||
assert device.actions[-1].user == trade.user_to
|
assert device.actions[-1].user == trade.user_to
|
||||||
assert device.actions[-2].t == 'Revoke'
|
assert device.actions[-2].t == 'Revoke'
|
||||||
assert device.actions[-2].user == trade.user_from
|
assert device.actions[-2].user == trade.user_from
|
||||||
|
@ -2329,6 +2330,7 @@ def test_trade_case9(user: UserClient, user2: UserClient):
|
||||||
assert device.actions[-4].user == trade.user_from
|
assert device.actions[-4].user == trade.user_from
|
||||||
assert device.actions[-5].t == 'Trade'
|
assert device.actions[-5].t == 'Trade'
|
||||||
assert device.actions[-5].author == trade.user_to
|
assert device.actions[-5].author == trade.user_to
|
||||||
|
assert device.trading_for_web(trade.lot) == 'RevokeConfirmed'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
|
@ -2372,6 +2374,7 @@ def test_trade_case10(user: UserClient, user2: UserClient):
|
||||||
device1, device = trade.devices
|
device1, device = trade.devices
|
||||||
|
|
||||||
assert device.owner == trade.user_from
|
assert device.owner == trade.user_from
|
||||||
|
# assert device.trading_for_web(trade.lot) == 'Confirm'
|
||||||
|
|
||||||
request_confirm = {
|
request_confirm = {
|
||||||
'type': 'Confirm',
|
'type': 'Confirm',
|
||||||
|
@ -2381,6 +2384,7 @@ def test_trade_case10(user: UserClient, user2: UserClient):
|
||||||
|
|
||||||
# Normal confirm
|
# Normal confirm
|
||||||
user.post(res=models.Action, data=request_confirm)
|
user.post(res=models.Action, data=request_confirm)
|
||||||
|
# assert device.trading_for_web(trade.lot) == 'TradeConfirmed'
|
||||||
|
|
||||||
assert device.owner == trade.user_to
|
assert device.owner == trade.user_to
|
||||||
|
|
||||||
|
@ -2392,18 +2396,18 @@ def test_trade_case10(user: UserClient, user2: UserClient):
|
||||||
|
|
||||||
# Normal revoke
|
# Normal revoke
|
||||||
user2.post(res=models.Action, data=request_revoke)
|
user2.post(res=models.Action, data=request_revoke)
|
||||||
|
assert device.trading_for_web(trade.lot) == 'Revoke'
|
||||||
|
|
||||||
request_confirm_revoke = {
|
request_confirm_revoke = {
|
||||||
'type': 'ConfirmRevoke',
|
'type': 'Revoke',
|
||||||
'action': device.actions[-1].id,
|
'action': trade.id,
|
||||||
'devices': [device.id],
|
'devices': [device.id],
|
||||||
}
|
}
|
||||||
|
|
||||||
user.post(res=models.Action, data=request_confirm_revoke)
|
user.post(res=models.Action, data=request_confirm_revoke)
|
||||||
|
|
||||||
assert device.owner == trade.user_from
|
assert device.owner == trade.user_from
|
||||||
|
assert device.actions[-1].t == 'Revoke'
|
||||||
assert device.actions[-1].t == 'ConfirmRevoke'
|
|
||||||
assert device.actions[-1].user == trade.user_to
|
assert device.actions[-1].user == trade.user_to
|
||||||
assert device.actions[-2].t == 'Revoke'
|
assert device.actions[-2].t == 'Revoke'
|
||||||
assert device.actions[-2].user == trade.user_from
|
assert device.actions[-2].user == trade.user_from
|
||||||
|
@ -2413,6 +2417,7 @@ def test_trade_case10(user: UserClient, user2: UserClient):
|
||||||
assert device.actions[-4].user == trade.user_from
|
assert device.actions[-4].user == trade.user_from
|
||||||
assert device.actions[-5].t == 'Trade'
|
assert device.actions[-5].t == 'Trade'
|
||||||
assert device.actions[-5].author == trade.user_to
|
assert device.actions[-5].author == trade.user_to
|
||||||
|
assert device.trading_for_web(trade.lot) == 'RevokeConfirmed'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
|
@ -2449,6 +2454,7 @@ def test_trade_case11(user: UserClient, user2: UserClient):
|
||||||
trade = models.Trade.query.one()
|
trade = models.Trade.query.one()
|
||||||
|
|
||||||
device1, device = trade.devices
|
device1, device = trade.devices
|
||||||
|
assert device.trading_for_web(trade.lot) == 'Confirm'
|
||||||
|
|
||||||
request_confirm = {
|
request_confirm = {
|
||||||
'type': 'Confirm',
|
'type': 'Confirm',
|
||||||
|
@ -2457,21 +2463,24 @@ def test_trade_case11(user: UserClient, user2: UserClient):
|
||||||
}
|
}
|
||||||
|
|
||||||
user2.post(res=models.Action, data=request_confirm)
|
user2.post(res=models.Action, data=request_confirm)
|
||||||
|
assert device.trading_for_web(trade.lot) == 'TradeConfirmed'
|
||||||
|
|
||||||
lot, _ = user2.delete({},
|
lot, _ = user2.delete({},
|
||||||
res=Lot,
|
res=Lot,
|
||||||
item='{}/devices'.format(lot['id']),
|
item='{}/devices'.format(lot['id']),
|
||||||
query=devices[-1:], status=200)
|
query=devices[-1:], status=200)
|
||||||
|
assert device.trading_for_web(trade.lot) == 'Revoke'
|
||||||
|
|
||||||
request_confirm_revoke = {
|
request_confirm_revoke = {
|
||||||
'type': 'ConfirmRevoke',
|
'type': 'Revoke',
|
||||||
'action': device.actions[-1].id,
|
'action': trade.id,
|
||||||
'devices': [device.id],
|
'devices': [device.id],
|
||||||
}
|
}
|
||||||
|
|
||||||
user.post(res=models.Action, data=request_confirm_revoke)
|
user.post(res=models.Action, data=request_confirm_revoke)
|
||||||
|
assert device.trading_for_web(trade.lot) == 'RevokeConfirmed'
|
||||||
|
|
||||||
assert device.actions[-1].t == 'ConfirmRevoke'
|
assert device.actions[-1].t == 'Revoke'
|
||||||
assert device.actions[-1].user == trade.user_to
|
assert device.actions[-1].user == trade.user_to
|
||||||
assert device.actions[-2].t == 'Revoke'
|
assert device.actions[-2].t == 'Revoke'
|
||||||
assert device.actions[-2].user == trade.user_from
|
assert device.actions[-2].user == trade.user_from
|
||||||
|
@ -2517,6 +2526,7 @@ def test_trade_case12(user: UserClient, user2: UserClient):
|
||||||
trade = models.Trade.query.one()
|
trade = models.Trade.query.one()
|
||||||
|
|
||||||
device1, device = trade.devices
|
device1, device = trade.devices
|
||||||
|
assert device.trading_for_web(trade.lot) == 'Confirm'
|
||||||
|
|
||||||
# Normal confirm
|
# Normal confirm
|
||||||
request_confirm = {
|
request_confirm = {
|
||||||
|
@ -2526,6 +2536,7 @@ def test_trade_case12(user: UserClient, user2: UserClient):
|
||||||
}
|
}
|
||||||
|
|
||||||
user2.post(res=models.Action, data=request_confirm)
|
user2.post(res=models.Action, data=request_confirm)
|
||||||
|
assert device.trading_for_web(trade.lot) == 'TradeConfirmed'
|
||||||
|
|
||||||
request_revoke = {
|
request_revoke = {
|
||||||
'type': 'Revoke',
|
'type': 'Revoke',
|
||||||
|
@ -2535,16 +2546,18 @@ def test_trade_case12(user: UserClient, user2: UserClient):
|
||||||
|
|
||||||
# Normal revoke
|
# Normal revoke
|
||||||
user2.post(res=models.Action, data=request_revoke)
|
user2.post(res=models.Action, data=request_revoke)
|
||||||
|
assert device.trading_for_web(trade.lot) == 'Revoke'
|
||||||
|
|
||||||
request_confirm_revoke = {
|
request_confirm_revoke = {
|
||||||
'type': 'ConfirmRevoke',
|
'type': 'Revoke',
|
||||||
'action': device.actions[-1].id,
|
'action': trade.id,
|
||||||
'devices': [device.id],
|
'devices': [device.id],
|
||||||
}
|
}
|
||||||
|
|
||||||
user.post(res=models.Action, data=request_confirm_revoke)
|
user.post(res=models.Action, data=request_confirm_revoke)
|
||||||
|
assert device.trading_for_web(trade.lot) == 'RevokeConfirmed'
|
||||||
|
|
||||||
assert device.actions[-1].t == 'ConfirmRevoke'
|
assert device.actions[-1].t == 'Revoke'
|
||||||
assert device.actions[-1].user == trade.user_to
|
assert device.actions[-1].user == trade.user_to
|
||||||
assert device.actions[-2].t == 'Revoke'
|
assert device.actions[-2].t == 'Revoke'
|
||||||
assert device.actions[-2].user == trade.user_from
|
assert device.actions[-2].user == trade.user_from
|
||||||
|
@ -2595,6 +2608,8 @@ def test_trade_case13(user: UserClient, user2: UserClient):
|
||||||
query=devices[-1:])
|
query=devices[-1:])
|
||||||
|
|
||||||
device1, device = trade.devices
|
device1, device = trade.devices
|
||||||
|
assert device1.trading_for_web(trade.lot) == 'NeedConfirmation'
|
||||||
|
assert device.trading_for_web(trade.lot) == 'Confirm'
|
||||||
|
|
||||||
request_confirm = {
|
request_confirm = {
|
||||||
'type': 'Confirm',
|
'type': 'Confirm',
|
||||||
|
@ -2603,21 +2618,26 @@ def test_trade_case13(user: UserClient, user2: UserClient):
|
||||||
}
|
}
|
||||||
|
|
||||||
user.post(res=models.Action, data=request_confirm)
|
user.post(res=models.Action, data=request_confirm)
|
||||||
|
assert device1.trading_for_web(trade.lot) == 'Confirm'
|
||||||
|
assert device.trading_for_web(trade.lot) == 'TradeConfirmed'
|
||||||
|
|
||||||
lot, _ = user.delete({},
|
lot, _ = user.delete({},
|
||||||
res=Lot,
|
res=Lot,
|
||||||
item='{}/devices'.format(lot['id']),
|
item='{}/devices'.format(lot['id']),
|
||||||
query=devices[-1:], status=200)
|
query=devices[-1:], status=200)
|
||||||
|
assert device1.trading_for_web(trade.lot) == 'Confirm'
|
||||||
|
assert device.trading_for_web(trade.lot) == 'Revoke'
|
||||||
|
|
||||||
request_confirm_revoke = {
|
request_confirm_revoke = {
|
||||||
'type': 'ConfirmRevoke',
|
'type': 'Revoke',
|
||||||
'action': device.actions[-1].id,
|
'action': trade.id,
|
||||||
'devices': [device.id],
|
'devices': [device.id],
|
||||||
}
|
}
|
||||||
|
|
||||||
user2.post(res=models.Action, data=request_confirm_revoke)
|
user2.post(res=models.Action, data=request_confirm_revoke)
|
||||||
|
assert device.trading_for_web(trade.lot) == 'RevokeConfirmed'
|
||||||
|
|
||||||
assert device.actions[-1].t == 'ConfirmRevoke'
|
assert device.actions[-1].t == 'Revoke'
|
||||||
assert device.actions[-1].user == trade.user_from
|
assert device.actions[-1].user == trade.user_from
|
||||||
assert device.actions[-2].t == 'Revoke'
|
assert device.actions[-2].t == 'Revoke'
|
||||||
assert device.actions[-2].user == trade.user_to
|
assert device.actions[-2].user == trade.user_to
|
||||||
|
@ -2668,6 +2688,8 @@ def test_trade_case14(user: UserClient, user2: UserClient):
|
||||||
query=devices[-1:])
|
query=devices[-1:])
|
||||||
|
|
||||||
device1, device = trade.devices
|
device1, device = trade.devices
|
||||||
|
assert device1.trading_for_web(trade.lot) == 'NeedConfirmation'
|
||||||
|
assert device.trading_for_web(trade.lot) == 'Confirm'
|
||||||
|
|
||||||
# Normal confirm
|
# Normal confirm
|
||||||
request_confirm = {
|
request_confirm = {
|
||||||
|
@ -2677,6 +2699,7 @@ def test_trade_case14(user: UserClient, user2: UserClient):
|
||||||
}
|
}
|
||||||
|
|
||||||
user.post(res=models.Action, data=request_confirm)
|
user.post(res=models.Action, data=request_confirm)
|
||||||
|
assert device.trading_for_web(trade.lot) == 'TradeConfirmed'
|
||||||
|
|
||||||
request_revoke = {
|
request_revoke = {
|
||||||
'type': 'Revoke',
|
'type': 'Revoke',
|
||||||
|
@ -2686,16 +2709,18 @@ def test_trade_case14(user: UserClient, user2: UserClient):
|
||||||
|
|
||||||
# Normal revoke
|
# Normal revoke
|
||||||
user.post(res=models.Action, data=request_revoke)
|
user.post(res=models.Action, data=request_revoke)
|
||||||
|
assert device.trading_for_web(trade.lot) == 'Revoke'
|
||||||
|
|
||||||
request_confirm_revoke = {
|
request_confirm_revoke = {
|
||||||
'type': 'ConfirmRevoke',
|
'type': 'Revoke',
|
||||||
'action': device.actions[-1].id,
|
'action': trade.id,
|
||||||
'devices': [device.id],
|
'devices': [device.id],
|
||||||
}
|
}
|
||||||
|
|
||||||
user2.post(res=models.Action, data=request_confirm_revoke)
|
user2.post(res=models.Action, data=request_confirm_revoke)
|
||||||
|
assert device.trading_for_web(trade.lot) == 'RevokeConfirmed'
|
||||||
|
|
||||||
assert device.actions[-1].t == 'ConfirmRevoke'
|
assert device.actions[-1].t == 'Revoke'
|
||||||
assert device.actions[-1].user == trade.user_from
|
assert device.actions[-1].user == trade.user_from
|
||||||
assert device.actions[-2].t == 'Revoke'
|
assert device.actions[-2].t == 'Revoke'
|
||||||
assert device.actions[-2].user == trade.user_to
|
assert device.actions[-2].user == trade.user_to
|
||||||
|
@ -2716,7 +2741,7 @@ def test_action_web_erase(user: UserClient, client: Client):
|
||||||
hash3 = hashlib.sha3_256(bfile.read()).hexdigest()
|
hash3 = hashlib.sha3_256(bfile.read()).hexdigest()
|
||||||
snap, _ = user.post(file('acer.happy.battery.snapshot'), res=models.Snapshot)
|
snap, _ = user.post(file('acer.happy.battery.snapshot'), res=models.Snapshot)
|
||||||
request = {'type': 'DataWipe', 'devices': [snap['device']['id']], 'name': 'borrado universal', 'severity': 'Info', 'description': 'nada que describir', 'url': 'http://www.google.com/', 'documentId': '33', 'endTime': '2021-07-07T22:00:00.000Z', 'filename': 'Certificado de borrado1.pdf', 'hash': hash3, 'success': 1, 'software': "Blanco"}
|
request = {'type': 'DataWipe', 'devices': [snap['device']['id']], 'name': 'borrado universal', 'severity': 'Info', 'description': 'nada que describir', 'url': 'http://www.google.com/', 'documentId': '33', 'endTime': '2021-07-07T22:00:00.000Z', 'filename': 'Certificado de borrado1.pdf', 'hash': hash3, 'success': 1, 'software': "Blanco"}
|
||||||
|
|
||||||
user.post(res=models.Action, data=request)
|
user.post(res=models.Action, data=request)
|
||||||
action = models.DataWipe.query.one()
|
action = models.DataWipe.query.one()
|
||||||
for dev in action.devices:
|
for dev in action.devices:
|
||||||
|
|
|
@ -181,14 +181,13 @@ def test_complet_metrics_with_trade(user: UserClient, user2: UserClient):
|
||||||
query=[('filter', {'type': ['Computer']})])
|
query=[('filter', {'type': ['Computer']})])
|
||||||
|
|
||||||
body1_lenovo = 'O48N2;desktop-lenovo-9644w8n-0169622-00:1a:6b:5e:7f:10;;Trade;foo@foo.com;'
|
body1_lenovo = 'O48N2;desktop-lenovo-9644w8n-0169622-00:1a:6b:5e:7f:10;;Trade;foo@foo.com;'
|
||||||
body1_lenovo += 'foo2@foo.com;Supplier;False;Use;;'
|
body1_lenovo += 'foo2@foo.com;Supplier;NeedConfirmation;Use;;'
|
||||||
body2_lenovo = ';;0;0;Trade;0;0\n'
|
body2_lenovo = ';;0;0;Trade;0;0\n'
|
||||||
|
|
||||||
body1_acer = 'J2MA2;laptop-acer-aohappy-lusea0d010038879a01601-00:26:c7:8e:cb:8c;;Trade;'
|
body1_acer = 'J2MA2;laptop-acer-aohappy-lusea0d010038879a01601-00:26:c7:8e:cb:8c;;Trade;'
|
||||||
body1_acer += 'foo@foo.com;foo2@foo.com;Supplier;False;;;;;0;'
|
body1_acer += 'foo@foo.com;foo2@foo.com;Supplier;NeedConfirmation;;;;;0;'
|
||||||
body2_acer = ';;0;0;Trade;0;4692.0\n'
|
body2_acer = ';;0;0;Trade;0;4692.0\n'
|
||||||
|
|
||||||
# import pdb; pdb.set_trace()
|
|
||||||
assert body1_lenovo in csv_str
|
assert body1_lenovo in csv_str
|
||||||
assert body2_lenovo in csv_str
|
assert body2_lenovo in csv_str
|
||||||
assert body1_acer in csv_str
|
assert body1_acer in csv_str
|
||||||
|
@ -203,7 +202,7 @@ def test_complet_metrics_with_trade(user: UserClient, user2: UserClient):
|
||||||
query=[('filter', {'type': ['Computer']})])
|
query=[('filter', {'type': ['Computer']})])
|
||||||
|
|
||||||
body1_lenovo = 'O48N2;desktop-lenovo-9644w8n-0169622-00:1a:6b:5e:7f:10;;Trade;foo@foo.com;'
|
body1_lenovo = 'O48N2;desktop-lenovo-9644w8n-0169622-00:1a:6b:5e:7f:10;;Trade;foo@foo.com;'
|
||||||
body1_lenovo += 'foo2@foo.com;Supplier;False;Use;Use;'
|
body1_lenovo += 'foo2@foo.com;Supplier;NeedConfirmation;Use;Use;'
|
||||||
body2_lenovo = ';;0;0;Trade;0;0\n'
|
body2_lenovo = ';;0;0;Trade;0;0\n'
|
||||||
body2_acer = ';;0;0;Trade;0;4692.0\n'
|
body2_acer = ';;0;0;Trade;0;4692.0\n'
|
||||||
|
|
||||||
|
@ -353,8 +352,8 @@ def test_bug_trade_confirmed(user: UserClient, user2: UserClient):
|
||||||
accept='text/csv',
|
accept='text/csv',
|
||||||
query=[('filter', {'type': ['Computer']})])
|
query=[('filter', {'type': ['Computer']})])
|
||||||
|
|
||||||
body_not_confirmed = "Trade;foo2@foo.com;foo@foo.com;Receiver;False;"
|
body_not_confirmed = "Trade;foo2@foo.com;foo@foo.com;Receiver;NeedConfirmation;"
|
||||||
body_confirmed = "Trade;foo2@foo.com;foo@foo.com;Receiver;True;"
|
body_confirmed = "Trade;foo2@foo.com;foo@foo.com;Receiver;TradeConfirmed;"
|
||||||
|
|
||||||
assert body_not_confirmed in csv_not_confirmed
|
assert body_not_confirmed in csv_not_confirmed
|
||||||
assert body_confirmed in csv_confirmed
|
assert body_confirmed in csv_confirmed
|
||||||
|
|
Reference in New Issue