add historical#88
Open
vladkhard wants to merge 2 commits intoopenprocurement:use_requestsfrom
vladkhard:use_requests
Open
add historical#88vladkhard wants to merge 2 commits intoopenprocurement:use_requestsfrom vladkhard:use_requests
vladkhard wants to merge 2 commits intoopenprocurement:use_requestsfrom
vladkhard:use_requests
Conversation
Member
|
Зміни мають іти з тестами |
VDigitall
reviewed
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): |
Member
There was a problem hiding this comment.
Я б не робив revision обовязковим
Author
There was a problem hiding this comment.
Чому? Це викoристовується тільки для хісторікала, реквест без ревізії не має сенсу - щоб взяти актуальну версію документа, досить використати get_resource_item
Member
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'])
Member
|
@vladkhard потрібно ще тести. |
VDigitall
reviewed
Jan 18, 2018
| def side_effect(_, headers): | ||
| return item if headers["x-revision-n"] else response | ||
|
|
||
| self.client._get_resource_item = MagicMock(side_effect=side_effect) |
Member
There was a problem hiding this comment.
VDigitall
reviewed
Feb 9, 2018
| 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) | ||
|
|
Member
There was a problem hiding this comment.
Тут краще загорнути у for і переконатись що ми дійсно отримуємо 404 всі рази.
VDigitall
reviewed
Feb 14, 2018
| import unittest | ||
|
|
||
| from openprocurement_client.tests import tests, tests_sync | ||
| from openprocurement_client.tests import tests, tests_sync, tests_api_base_client |
Member
|
@vladkhard тест провалився |
VDigitall
reviewed
Feb 15, 2018
| item_id, revision=revisions_limit - 1), actual_response) | ||
|
|
||
| for revision in (0, revisions_limit + 1, None): | ||
| try: |
Member
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
approved these changes
Feb 15, 2018
Member
Member
|
@vladkhard, дані зміни вже не акутальні оскільки |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change is