Uh oh!
There was an error while loading. Please reload this page.
add historical - #88
Conversation
VDigitall
commented
Jan 16, 2018
Зміни мають іти з тестами |
| def get_resource_item_historical(self, id, headers=None): | ||
| return self._get_resource_item('{}/{}/historical'.format(self.prefix_path, id), headers=headers) | ||
| def get_resource_item_historical(self, id, revision, headers=None): |
There was a problem hiding this comment.
Я б не робив revision обовязковим
There was a problem hiding this comment.
Чому? Це викoристовується тільки для хісторікала, реквест без ревізії не має сенсу - щоб взяти актуальну версію документа, досить використати get_resource_item
There was a problem hiding this comment.
Щоб в еджі замінити ось це
response = client.request(
'GET', '{}/{}/historical'.format(api_client_dict['client'].prefix_path, id)
)
revisions_number = int(response.headers['x-revision-n'])
VDigitall
commented
Jan 17, 2018
@vladkhard потрібно ще тести. |
| def side_effect(_, headers): | ||
| return item if headers["x-revision-n"] else response | ||
| self.client._get_resource_item = MagicMock(side_effect=side_effect) |
There was a problem hiding this comment.
| self.client.get_resource_item_historical(item_id, revision=0) | ||
| self.client.get_resource_item_historical(item_id, revision=revisions_limit + 1) | ||
| self.client.get_resource_item_historical(item_id, revision=None) | ||
There was a problem hiding this comment.
Тут краще загорнути у for і переконатись що ми дійсно отримуємо 404 всі рази.
| import unittest | ||
| from openprocurement_client.tests import tests, tests_sync | ||
| from openprocurement_client.tests import tests, tests_sync, tests_api_base_client |
VDigitall
commented
Feb 14, 2018
@vladkhard тест провалився |
| item_id, revision=revisions_limit - 1), actual_response) | ||
| for revision in (0, revisions_limit + 1, None): | ||
| try: |
There was a problem hiding this comment.
for revision in (0, revisions_limit + 1, None):
with self.assertRaises(InvalidResponse) as e:
self.client.get_resource_item_historical(item_id, revision=revision)
self.assertEqual(e.exception.status_code, 404)
VDigitall
commented
Mar 23, 2018
@vladkhard, дані зміни вже не акутальні оскільки |
This change is