Skip to content

Commit

Permalink
test change.date
Browse files Browse the repository at this point in the history
  • Loading branch information
vmaksymiv committed May 13, 2016
1 parent 98c3366 commit aa554db
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions openprocurement/contracting/api/tests/change.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def test_patch_change(self):
change = response.json['data']
self.assertEqual(change['status'], 'pending')
self.assertEqual(change['contractNumber'], u'№ 146')
creation_date = change['date']

now = get_now().isoformat()
response = self.app.patch_json('/contracts/{}/changes/{}?acc_token={}'.format(self.contract['id'], change['id'], self.contract_token),
Expand All @@ -213,11 +214,15 @@ def test_patch_change(self):
{'data': {'rationale_ru': 'шота на руськом'}})
self.assertEqual(response.status, '200 OK')
self.assertIn('rationale_ru', response.json['data'])
first_patch_date = response.json['data']['date']
self.assertEqual(first_patch_date, creation_date)

response = self.app.patch_json('/contracts/{}/changes/{}?acc_token={}'.format(self.contract['id'], change['id'], self.contract_token),
{'data': {'rationale_en': 'another cause desctiption'}})
self.assertEqual(response.status, '200 OK')
self.assertEqual(response.json['data']['rationale_en'], 'another cause desctiption')
second_patch_date = response.json['data']['date']
self.assertEqual(first_patch_date, second_patch_date)

response = self.app.patch_json('/contracts/{}/changes/{}?acc_token={}'.format(self.contract['id'], change['id'], self.contract_token),
{'data': {'id': '1234' * 8}})
Expand All @@ -237,6 +242,9 @@ def test_patch_change(self):
response = self.app.patch_json('/contracts/{}/changes/{}?acc_token={}'.format(self.contract['id'], change['id'], self.contract_token),
{'data': {'status': 'active'}})
self.assertEqual(response.status, '200 OK')
self.assertNotEqual(response.json['data']['date'], creation_date)
self.assertNotEqual(response.json['data']['date'], first_patch_date)
self.assertNotEqual(response.json['data']['date'], second_patch_date)

response = self.app.patch_json('/contracts/{}/changes/{}?acc_token={}'.format(self.contract['id'], change['id'], self.contract_token),
{'data': {'status': 'pending'}}, status=403)
Expand Down

0 comments on commit aa554db

Please sign in to comment.