Skip to content

Commit

Permalink
Set contract status to cancelled when lot become deleted (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksiyVeretiuk authored and leits committed Jul 19, 2018
1 parent a322619 commit c6c8e6a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions openregistry/lots/loki/tests/blanks/lot_blanks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1572,6 +1572,7 @@ def change_pending_deleted_lot(self):
self.assertEqual(response.json['data']['auctions'][0]['status'], 'cancelled')
self.assertEqual(response.json['data']['auctions'][1]['status'], 'cancelled')
self.assertEqual(response.json['data']['auctions'][2]['status'], 'cancelled')
self.assertEqual(response.json['data']['contracts'][0]['status'], 'cancelled')

# Create new lot in 'pending.deleted' status
self.app.authorization = ('Basic', ('broker', ''))
Expand Down Expand Up @@ -1602,6 +1603,7 @@ def change_pending_deleted_lot(self):
self.assertEqual(response.json['data']['auctions'][0]['status'], 'cancelled')
self.assertEqual(response.json['data']['auctions'][1]['status'], 'cancelled')
self.assertEqual(response.json['data']['auctions'][2]['status'], 'cancelled')
self.assertEqual(response.json['data']['contracts'][0]['status'], 'cancelled')

# Create new lot in 'pending.deleted' status
self.app.authorization = ('Basic', ('broker', ''))
Expand Down
1 change: 1 addition & 0 deletions openregistry/lots/loki/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def process_lot_status_change(request):
if lot.status == 'pending.deleted' and request.validated['data'].get('status') == 'deleted':
for auction in lot.auctions:
auction.status = 'cancelled'
lot.contracts[0].status = 'cancelled'


def process_caravan_contract_report_result(request):
Expand Down

0 comments on commit c6c8e6a

Please sign in to comment.