From bebc1b43465d03c0df1c427181cafa71ff8c0976 Mon Sep 17 00:00:00 2001 From: tim-s-ccs Date: Wed, 13 Nov 2024 12:02:36 +0000 Subject: [PATCH] Remove the evaluator questions Add the evaluator framework lots routes Add the evaluator framework lot sections routes Add the evaluator framework lot section evaluations routes --- CHANGELOG.md | 6 + dmapiclient/__init__.py | 2 +- dmapiclient/audit.py | 16 +- dmapiclient/data.py | 171 ++++++++-------- tests/test_data_api_client.py | 356 ++++++++++++++++------------------ 5 files changed, 272 insertions(+), 279 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9aa54e7..53d977c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ Records breaking changes from major version bumps +## 29.0.0 + +Update the lot questions reponses routes +Remove old evaluator questions routes +Add routes relating to evaluations + ## 28.0.0 Make Python 3.11 the minimum supported version diff --git a/dmapiclient/__init__.py b/dmapiclient/__init__.py index 660a0ae..318d32a 100644 --- a/dmapiclient/__init__.py +++ b/dmapiclient/__init__.py @@ -1,4 +1,4 @@ -__version__ = '28.0.0' +__version__ = '29.0.0' from .errors import APIError, HTTPError, InvalidResponse # noqa from .errors import REQUEST_ERROR_STATUS_CODE, REQUEST_ERROR_MESSAGE # noqa diff --git a/dmapiclient/audit.py b/dmapiclient/audit.py index 6278d87..6ca5b1f 100644 --- a/dmapiclient/audit.py +++ b/dmapiclient/audit.py @@ -99,12 +99,16 @@ class AuditTypes(Enum): update_lot_questions_response_answers = "update_lot_questions_response_answers" complete_lot_questions_response = "complete_lot_questions_response" - # Evaluator questions - create_evaluator_question = "create_evaluator_question" - update_evaluator_question_assignment_status = "update_evaluator_question_assignment_status" - update_evaluator_question_answers = "update_evaluator_question_answers" - create_final_evaluator_question = "create_final_evaluator_question" - update_final_evaluator_question_answers = "update_final_evaluator_question_answers" + # Evaluations + update_evaluator_framework_lot_assignment_status = "update_evaluator_framework_lot_assignment_status" + create_evaluator_framework_lot = "create_evaluator_framework_lot" + update_evaluator_framework_lot_status = "update_evaluator_framework_lot_status" + create_evaluator_framework_lot_section = "create_evaluator_framework_lot_section" + update_evaluator_framework_lot_section_assignment_status = \ + "update_evaluator_framework_lot_section_assignment_status" + + create_evaluator_framework_lot_section_evaluation = "create_evaluator_framework_lot_section_evaluation" + update_evaluator_framework_lot_section_evaluation = "update_evaluator_framework_lot_section_evaluation" @staticmethod def is_valid_audit_type(test_audit_type): diff --git a/dmapiclient/data.py b/dmapiclient/data.py index 5e16701..e35520d 100644 --- a/dmapiclient/data.py +++ b/dmapiclient/data.py @@ -410,27 +410,6 @@ def export_suppliers(self, framework_slug): export_suppliers_iter = make_iter_method('export_suppliers', 'suppliers') export_suppliers_iter.__name__ = str("export_suppliers_iter") - def find_framework_suppliers_with_evaluation_for_lot( - self, - framework, - lot, - page=None, - ): - params = {} - - if page is not None: - params['page'] = page - - return self._get( - f"/frameworks/{framework}/suppliers/lots/{lot}/evaluations", - params=params - ) - - find_framework_suppliers_with_evaluation_for_lot_iter = \ - make_iter_method('find_framework_suppliers_with_evaluation_for_lot', 'supplierFrameworks') - find_framework_suppliers_with_evaluation_for_lot_iter.__name__ = \ - str("find_framework_suppliers_with_evaluation_for_lot_iter") - # Users def create_user(self, user): @@ -1529,31 +1508,35 @@ def find_lot_questions_responses( ) params = { + 'framework': framework_slug, + 'supplier_id': supplier_id, 'page': page, } - return self._get(f"/suppliers/{supplier_id}/frameworks/{framework_slug}/lot-questions-responses", params=params) + return self._get("/lot-questions-responses", params=params) find_lot_questions_responses_iter = make_iter_method('find_lot_questions_responses', 'lotQuestionsResponses') find_lot_questions_responses_iter.__name__ = str("find_lot_questions_responses_iter") - def get_lot_questions_response(self, supplier_id, framework_slug, lot_slug): - return self._get( - f"/suppliers/{supplier_id}/frameworks/{framework_slug}/lot-questions-responses/{lot_slug}" - ) - def create_lot_questions_response(self, supplier_id, framework_slug, lot_slug, user=None): return self._post_with_updated_by( - f"/suppliers/{supplier_id}/frameworks/{framework_slug}/lot-questions-responses/{lot_slug}", - data={}, + "/lot-questions-responses", + data={ + "supplierId": supplier_id, + "frameworkSlug": framework_slug, + "lotSlug": lot_slug, + }, user=user, ) + def get_lot_questions_response(self, lot_questions_response_id): + return self._get( + f"/lot-questions-responses/{lot_questions_response_id}" + ) + def update_lot_questions_response( self, - supplier_id, - framework_slug, - lot_slug, + lot_questions_response_id, lot_questions_response, user=None, page_questions=None @@ -1566,28 +1549,25 @@ def update_lot_questions_response( data['page_questions'] = page_questions return self._patch_with_updated_by( - f"/suppliers/{supplier_id}/frameworks/{framework_slug}/lot-questions-responses/{lot_slug}", + f"/lot-questions-responses/{lot_questions_response_id}", data=data, user=user, ) - def complete_lot_questions_response(self, supplier_id, framework_slug, lot_slug, user=None): + def complete_lot_questions_response(self, lot_questions_response_id, user=None): return self._post_with_updated_by( - f"/suppliers/{supplier_id}/frameworks/{framework_slug}/lot-questions-responses/{lot_slug}/complete", + f"/lot-questions-responses/{lot_questions_response_id}/complete", data={}, user=user, ) - # Evaluator questions + # Evaluations - def find_evaluator_questions( + def find_evaluator_framework_lots( self, framework, lot, user_id=None, - supplier_id=None, - question_id=None, - status=None, assigned=True, page=None, ): @@ -1597,75 +1577,104 @@ def find_evaluator_questions( 'assigned': bool(assigned), 'page': page, 'user_id': user_id, - 'supplier_id': supplier_id, - 'question_id': question_id, - 'status': status } - return self._get("/evaluator-questions", params=params) + return self._get("/evaluations/evaluator-framework-lots", params=params) - find_evaluator_questions_iter = make_iter_method('find_evaluator_questions', 'evaluatorQuestions') - find_evaluator_questions_iter.__name__ = str("find_evaluator_questions_iter") + find_evaluator_framework_lots_iter = make_iter_method('find_evaluator_framework_lots', 'evaluatorFrameworkLots') + find_evaluator_framework_lots_iter.__name__ = str("find_evaluator_framework_lots") - def find_evaluator_question_users(self, framework, lot, page=None): - return self._get( - f"/evaluator-questions/{framework}/{lot}/users", - params={ - 'page': page - } - ) - - def get_evaluator_question(self, evaluator_question_id): - return self._get( - f"/evaluator-questions/{evaluator_question_id}" + def update_assigned_evaluators_for_framework_lot( + self, + framework, + lot, + users, + user=None + ): + return self._post_with_updated_by( + "/evaluations/evaluator-framework-lots", + data={ + 'evaluatorFrameworkLots': { + 'frameworkSlug': framework, + "lotSlug": lot, + 'users': users, + } + }, + user=user, ) - def get_final_evaluator_question(self, framework, lot, supplier_id, question_id): - return self._get( - f"/evaluator-questions/{framework}/{lot}/{supplier_id}/{question_id}/final", + def update_evaluator_framework_lot_status( + self, + evaluator_framework_lot_id, + status, + user=None + ): + return self._post_with_updated_by( + f"/evaluations/evaluator-framework-lots/{evaluator_framework_lot_id}/status/{status}", + data={}, + user=user, ) - def update_evaluator_question(self, evaluator_question_id, elvauator_question, user=None): - return self._patch_with_updated_by( - f"/evaluator-questions/{evaluator_question_id}", + def update_assigned_sections_for_evaluator_framework_lot( + self, + framework, + lot, + section_slug, + evaluator_framework_lots, + user=None + ): + return self._post_with_updated_by( + "/evaluations/evaluator-framework-lot-sections", data={ - "evaluatorQuestions": elvauator_question, + 'evaluatorFrameworkLotSections': { + 'evaluatorFrameworkLots': evaluator_framework_lots, + 'frameworkSlug': framework, + "lotSlug": lot, + 'sectionSlug': section_slug, + } }, user=user, ) - def set_final_evaluator_question( + def get_evaluator_framework_lot_section_evaluation( self, - framework, - lot, + evaluator_framework_lot_section_evaluation_id, + ): + return self._get( + "/evaluations/evaluator-framework-lot-section-evaluations/" + f"{evaluator_framework_lot_section_evaluation_id}" + ) + + def create_evaluator_framework_lot_section_evaluation( + self, + evaluator_framework_lot_section_id, supplier_id, - question_id, - elvauator_question, + evaluator_framework_lot_section_evaluation, + page_questions, user=None ): return self._post_with_updated_by( - f"/evaluator-questions/{framework}/{lot}/{supplier_id}/{question_id}/final", + '/evaluations/evaluator-framework-lot-section-evaluations', data={ - "evaluatorQuestions": elvauator_question, + 'evaluatorFrameworkLotSectionId': evaluator_framework_lot_section_id, + 'supplierId': supplier_id, + 'evaluatorFrameworkLotSectionEvaluations': evaluator_framework_lot_section_evaluation, + 'page_questions': page_questions }, user=user, ) - def update_assigned_evaluators_for_question( + def update_evaluator_framework_lot_section_evaluation( self, - framework, - lot, - supplier_id, - question_id, - users, + evaluator_framework_lot_section_evaluation_id, + evaluator_framework_lot_section_evaluation, user=None ): return self._post_with_updated_by( - f"/evaluator-questions/{framework}/{lot}/{supplier_id}/{question_id}", + '/evaluations/evaluator-framework-lot-section-evaluations' + f'/{evaluator_framework_lot_section_evaluation_id}', data={ - 'evaluatorQuestions': { - 'users': users - } + 'evaluatorFrameworkLotSectionEvaluations': evaluator_framework_lot_section_evaluation, }, user=user, ) diff --git a/tests/test_data_api_client.py b/tests/test_data_api_client.py index 49bd3d1..1f4b032 100644 --- a/tests/test_data_api_client.py +++ b/tests/test_data_api_client.py @@ -1287,17 +1287,6 @@ def test_can_export_suppliers(self, data_client, rmock): assert rmock.called assert result == {"suppliers": "result"} - def test_find_framework_suppliers_with_evaluation_for_lot(self, data_client, rmock): - rmock.get( - "http://baseurl/frameworks/g-cloud-9/suppliers/lots/g-lot/evaluations", - json={"supplierFrameworks": "result"}, - status_code=200 - ) - result = data_client.find_framework_suppliers_with_evaluation_for_lot('g-cloud-9', 'g-lot') - - assert rmock.called - assert result == {"supplierFrameworks": "result"} - class TestAgreementMethods(object): def test_put_signed_agreement_on_hold(self, data_client, rmock): @@ -3091,51 +3080,40 @@ def test_find_lot_questions_responses_iter(self, data_client, rmock): data_client, rmock, method_name='find_lot_questions_responses_iter', model_name='lotQuestionsResponses', - url_path='suppliers/1234/frameworks/g-cloud-6/lot-questions-responses', + url_path='lot-questions-responses?framework=g-cloud-6&supplier_id=1234', iter_kwargs={ 'supplier_id': 1234, 'framework_slug': 'g-cloud-6' } ) - def test_find_evaluator_questions_iter(self, data_client, rmock): + def test_find_evaluator_framework_lots_iter(self, data_client, rmock): self._test_find_iter( data_client, rmock, - method_name='find_evaluator_questions_iter', - model_name='evaluatorQuestions', - url_path='evaluator-questions?framework=g-cloud-6&lot=g-things&assigned=True', + method_name='find_evaluator_framework_lots_iter', + model_name='evaluatorFrameworkLots', + url_path='evaluations/evaluator-framework-lots?framework=g-cloud-6&lot=g-things&assigned=True', iter_kwargs={ 'framework': 'g-cloud-6', 'lot': 'g-things' } ) - def test_find_evaluator_questions_iter_additional_arguments(self, data_client, rmock): + def test_find_evaluator_framework_lots_iter_additional_arguments(self, data_client, rmock): rmock.get( - 'http://baseurl/evaluator-questions?framework=g-cloud-6&lot=g-things&assigned=True&user_id=123', + 'http://baseurl/evaluations/evaluator-framework-lots?' + 'framework=g-cloud-6&lot=g-things&assigned=True&user_id=123', json={ 'links': {}, - 'evaluatorQuestions': [{'id': 1}, {'id': 2}] + 'evaluatorFrameworkLots': [{'id': 1}, {'id': 2}] }, status_code=200) - result = data_client.find_evaluator_questions_iter('g-cloud-6', 'g-things', user_id=123) + result = data_client.find_evaluator_framework_lots_iter('g-cloud-6', 'g-things', user_id=123) results = list(result) assert len(results) == 2 - def test_find_framework_suppliers_with_evaluation_for_lot_iter(self, data_client, rmock): - self._test_find_iter( - data_client, rmock, - method_name='find_framework_suppliers_with_evaluation_for_lot_iter', - model_name='supplierFrameworks', - url_path='frameworks/g-cloud-6/suppliers/lots/g-lot/evaluations', - iter_kwargs={ - 'framework': 'g-cloud-6', - 'lot': 'g-lot', - } - ) - class TestCommunicationsMethods(object): def test_find_communications(self, data_client, rmock): @@ -3927,7 +3905,7 @@ def test_update_system_message_with_show_and_data(self, data_client, rmock): class TestLotQuestionsResponsesMethods(object): def test_find_lot_questions_responses(self, data_client, rmock): rmock.get( - "http://baseurl/suppliers/1234/frameworks/g-cloud-6/lot-questions-responses", + "http://baseurl/lot-questions-responses?framework=g-cloud-6&supplier_id=1234", json={"lotQuestionsResponses": "result"}, status_code=200) @@ -3938,7 +3916,7 @@ def test_find_lot_questions_responses(self, data_client, rmock): def test_find_lot_questions_responses_adds_page_parameter(self, data_client, rmock): rmock.get( - "http://baseurl/suppliers/1234/frameworks/g-cloud-6/lot-questions-responses?page=2", + "http://baseurl/lot-questions-responses?framework=g-cloud-6&supplier_id=1234&page=2", json={"lotQuestionsResponses": "result"}, status_code=200) @@ -3947,49 +3925,52 @@ def test_find_lot_questions_responses_adds_page_parameter(self, data_client, rmo assert result == {"lotQuestionsResponses": "result"} assert rmock.called + def test_create_lot_questions_response(self, data_client, rmock): + rmock.post( + "http://baseurl/lot-questions-responses", + json={"lotQuestionsResponses": {"question": "answer"}}, + status_code=201) + + result = data_client.create_lot_questions_response(1234, 'g-cloud-6', 'g-lot', "user") + + assert result == {'lotQuestionsResponses': {'question': 'answer'}} + assert rmock.called + assert rmock.request_history[0].json() == { + 'supplierId': 1234, + 'frameworkSlug': 'g-cloud-6', + 'lotSlug': 'g-lot', + 'updated_by': 'user', + } + def test_get_lot_questions_response(self, data_client, rmock): rmock.get( - "http://baseurl/suppliers/1234/frameworks/g-cloud-6/lot-questions-responses/g-lot", + "http://baseurl/lot-questions-responses/1234", json={"lotQuestionsResponses": "result"}, status_code=200) - result = data_client.get_lot_questions_response(1234, 'g-cloud-6', 'g-lot') + result = data_client.get_lot_questions_response(1234) assert result == {"lotQuestionsResponses": "result"} assert rmock.called def test_get_lot_questions_response_should_return_404(self, data_client, rmock): rmock.get( - "http://baseurl/suppliers/1234/frameworks/g-cloud-6/lot-questions-responses/g-lot", + "http://baseurl/lot-questions-responses/1234", status_code=404) try: - data_client.get_lot_questions_response(1234, 'g-cloud-6', 'g-lot') + data_client.get_lot_questions_response(1234) except HTTPError: assert rmock.called - def test_create_lot_questions_response(self, data_client, rmock): - rmock.post( - "http://baseurl/suppliers/1234/frameworks/g-cloud-6/lot-questions-responses/g-lot", - json={"lotQuestionsResponses": {"question": "answer"}}, - status_code=201) - - result = data_client.create_lot_questions_response(1234, 'g-cloud-6', 'g-lot', "user") - - assert result == {'lotQuestionsResponses': {'question': 'answer'}} - assert rmock.called - assert rmock.request_history[0].json() == { - 'updated_by': 'user', - } - def test_update_lot_questions_response(self, data_client, rmock): rmock.patch( - "http://baseurl/suppliers/1234/frameworks/g-cloud-6/lot-questions-responses/g-lot", + "http://baseurl/lot-questions-responses/1234", json={"lotQuestionsResponses": {"question": "answer"}}, status_code=200 ) - result = data_client.update_lot_questions_response(1234, 'g-cloud-6', 'g-lot', {"question": "answer"}, "user") + result = data_client.update_lot_questions_response(1234, {"question": "answer"}, "user") assert result == {'lotQuestionsResponses': {'question': 'answer'}} assert rmock.called @@ -4000,15 +3981,13 @@ def test_update_lot_questions_response(self, data_client, rmock): def test_update_lot_questions_response_with_page_questions(self, data_client, rmock): rmock.patch( - "http://baseurl/suppliers/1234/frameworks/g-cloud-6/lot-questions-responses/g-lot", + "http://baseurl/lot-questions-responses/1234", json={"lotQuestionsResponses": {"question": "answer"}}, status_code=200 ) result = data_client.update_lot_questions_response( 1234, - 'g-cloud-6', - 'g-lot', {"question": "answer"}, "user", ["question"] @@ -4024,11 +4003,11 @@ def test_update_lot_questions_response_with_page_questions(self, data_client, rm def test_complete_lot_questions_response(self, data_client, rmock): rmock.post( - "http://baseurl/suppliers/1234/frameworks/g-cloud-6/lot-questions-responses/g-lot/complete", + "http://baseurl/lot-questions-responses/1234/complete", json={"message": "done"}, status_code=200) - result = data_client.complete_lot_questions_response(1234, 'g-cloud-6', 'g-lot', "user") + result = data_client.complete_lot_questions_response(1234, "user") assert result == {'message': 'done'} assert rmock.called @@ -4037,198 +4016,163 @@ def test_complete_lot_questions_response(self, data_client, rmock): } -class TestEvaluatorQuestionsMethods(object): - def test_find_evaluator_questions(self, data_client, rmock): - rmock.get( - "http://baseurl/evaluator-questions?framework=g-cloud-6&lot=g-things&assigned=True", - json={"evaluatorQuestions": "result"}, - status_code=200) - - result = data_client.find_evaluator_questions('g-cloud-6', 'g-things') - - assert result == {"evaluatorQuestions": "result"} - assert rmock.called - - def test_find_evaluator_questions_adds_page_parameter(self, data_client, rmock): - rmock.get( - "http://baseurl/evaluator-questions?framework=g-cloud-6&lot=g-things&assigned=True&page=2", - json={"evaluatorQuestions": "result"}, - status_code=200) - - result = data_client.find_evaluator_questions('g-cloud-6', 'g-things', page=2) - - assert result == {"evaluatorQuestions": "result"} - assert rmock.called - - def test_find_evaluator_questions_adds_user_id_parameter(self, data_client, rmock): - rmock.get( - "http://baseurl/evaluator-questions?framework=g-cloud-6&lot=g-things&assigned=True&user_id=1", - json={"evaluatorQuestions": "result"}, - status_code=200) - - result = data_client.find_evaluator_questions('g-cloud-6', 'g-things', user_id=1) - - assert result == {"evaluatorQuestions": "result"} - assert rmock.called - - def test_find_evaluator_questions_adds_supplier_id_parameter(self, data_client, rmock): +class TestEvaluatorFrameworkLotMethods(object): + def test_find_evaluator_framework_lots(self, data_client, rmock): rmock.get( - "http://baseurl/evaluator-questions?framework=g-cloud-6&lot=g-things&assigned=True&supplier_id=1", - json={"evaluatorQuestions": "result"}, + "http://baseurl/evaluations/evaluator-framework-lots?framework=g-cloud-6&lot=g-things&assigned=True", + json={"evaluatorFrameworkLots": "result"}, status_code=200) - result = data_client.find_evaluator_questions('g-cloud-6', 'g-things', supplier_id=1) + result = data_client.find_evaluator_framework_lots('g-cloud-6', 'g-things') - assert result == {"evaluatorQuestions": "result"} + assert result == {"evaluatorFrameworkLots": "result"} assert rmock.called - def test_find_evaluator_questions_adds_question_id_parameter(self, data_client, rmock): + def test_find_evaluator_framework_lots_adds_page_parameter(self, data_client, rmock): rmock.get( - "http://baseurl/evaluator-questions?framework=g-cloud-6&lot=g-things&assigned=True&question_id=1", - json={"evaluatorQuestions": "result"}, + "http://baseurl/evaluations/evaluator-framework-lots?framework=g-cloud-6&lot=g-things&assigned=True&page=2", + json={"evaluatorFrameworkLots": "result"}, status_code=200) - result = data_client.find_evaluator_questions('g-cloud-6', 'g-things', question_id=1) + result = data_client.find_evaluator_framework_lots('g-cloud-6', 'g-things', page=2) - assert result == {"evaluatorQuestions": "result"} + assert result == {"evaluatorFrameworkLots": "result"} assert rmock.called - def test_find_evaluator_questions_adds_status_parameter(self, data_client, rmock): + def test_find_evaluator_framework_lots_adds_user_id_parameter(self, data_client, rmock): rmock.get( - "http://baseurl/evaluator-questions?framework=g-cloud-6&lot=g-things&assigned=True&status=in_progress", - json={"evaluatorQuestions": "result"}, + "http://baseurl/evaluations/evaluator-framework-lots?" + "framework=g-cloud-6&lot=g-things&assigned=True&user_id=1", + json={"evaluatorFrameworkLots": "result"}, status_code=200) - result = data_client.find_evaluator_questions('g-cloud-6', 'g-things', status='in_progress') + result = data_client.find_evaluator_framework_lots('g-cloud-6', 'g-things', user_id=1) - assert result == {"evaluatorQuestions": "result"} + assert result == {"evaluatorFrameworkLots": "result"} assert rmock.called - def test_find_evaluator_questions_adds_assigned_parameter(self, data_client, rmock): + def test_find_evaluator_framework_lots_adds_assigned_parameter(self, data_client, rmock): rmock.get( - "http://baseurl/evaluator-questions?framework=g-cloud-6&lot=g-things&assigned=False", - json={"evaluatorQuestions": "result"}, + "http://baseurl/evaluations/evaluator-framework-lots?framework=g-cloud-6&lot=g-things&assigned=False", + json={"evaluatorFrameworkLots": "result"}, status_code=200) - result = data_client.find_evaluator_questions('g-cloud-6', 'g-things', assigned=False) + result = data_client.find_evaluator_framework_lots('g-cloud-6', 'g-things', assigned=False) - assert result == {"evaluatorQuestions": "result"} + assert result == {"evaluatorFrameworkLots": "result"} assert rmock.called - def test_find_evaluator_question_users_response(self, data_client, rmock): - rmock.get( - "http://baseurl/evaluator-questions/g-cloud-6/g-things/users", - json={"usersWithEvaluatorQuestions": "result"}, - status_code=200) - - result = data_client.find_evaluator_question_users('g-cloud-6', 'g-things') - - assert result == {"usersWithEvaluatorQuestions": "result"} - assert rmock.called - - def test_find_evaluator_question_users_adds_page_parameter(self, data_client, rmock): - rmock.get( - "http://baseurl/evaluator-questions/g-cloud-6/g-things/users?page=2", - json={"usersWithEvaluatorQuestions": "result"}, - status_code=200) - - result = data_client.find_evaluator_question_users('g-cloud-6', 'g-things', page=2) - - assert result == {"usersWithEvaluatorQuestions": "result"} - assert rmock.called - - def test_get_lot_questions_response(self, data_client, rmock): - rmock.get( - "http://baseurl/evaluator-questions/1234", - json={"evaluatorQuestions": "result"}, - status_code=200) - - result = data_client.get_evaluator_question(1234) - - assert result == {"evaluatorQuestions": "result"} - assert rmock.called - - def test_get_lot_questions_response_should_return_404(self, data_client, rmock): - rmock.get( - "http://baseurl/evaluator-questions/1234", - status_code=404) - - try: - data_client.get_evaluator_question(1234) - except HTTPError: - assert rmock.called - - def test_get_final_evaluator_question(self, data_client, rmock): - rmock.get( - "http://baseurl/evaluator-questions/g-cloud-6/g-lot/1234/theQuestion/final", - json={"evaluatorQuestions": "result"}, + def test_update_assigned_evaluators_for_framework_lot(self, data_client, rmock): + rmock.post( + "http://baseurl/evaluations/evaluator-framework-lots", + json={"message": "done"}, status_code=200 ) - result = data_client.get_final_evaluator_question( + result = data_client.update_assigned_evaluators_for_framework_lot( 'g-cloud-6', 'g-lot', - 1234, - 'theQuestion' + [ + 123, + 456 + ], + 'user' ) - assert result == {"evaluatorQuestions": "result"} + assert result == {'message': 'done'} assert rmock.called + assert rmock.request_history[0].json() == { + 'evaluatorFrameworkLots': { + 'frameworkSlug': 'g-cloud-6', + 'lotSlug': 'g-lot', + 'users': [ + 123, + 456 + ], + }, + 'updated_by': 'user', + } - def test_update_evaluator_question(self, data_client, rmock): - rmock.patch( - "http://baseurl/evaluator-questions/1234", - json={"evaluatorQuestions": {"question": "answer"}}, + def test_update_evaluator_framework_lot_status(self, data_client, rmock): + rmock.post( + "http://baseurl/evaluations/evaluator-framework-lots/1234/status/locked", + json={"message": "done"}, status_code=200 ) - result = data_client.update_evaluator_question(1234, {"question": "answer"}, "user") + result = data_client.update_evaluator_framework_lot_status( + 1234, + 'locked', + 'user' + ) - assert result == {'evaluatorQuestions': {'question': 'answer'}} + assert result == {'message': 'done'} assert rmock.called assert rmock.request_history[0].json() == { 'updated_by': 'user', - 'evaluatorQuestions': {'question': 'answer'} } - def test_set_final_evaluator_question(self, data_client, rmock): + def test_update_assigned_sections_for_evaluator_framework_lot(self, data_client, rmock): rmock.post( - "http://baseurl/evaluator-questions/g-cloud-6/g-lot/1234/theQuestion/final", + "http://baseurl/evaluations/evaluator-framework-lot-sections", json={"message": "done"}, status_code=200 ) - result = data_client.set_final_evaluator_question( + result = data_client.update_assigned_sections_for_evaluator_framework_lot( 'g-cloud-6', 'g-lot', - 1234, - 'theQuestion', - {"question": "answer"}, + 'section-slug', + [ + 123, + 456 + ], 'user' ) assert result == {'message': 'done'} assert rmock.called assert rmock.request_history[0].json() == { + 'evaluatorFrameworkLotSections': { + 'evaluatorFrameworkLots': [ + 123, + 456 + ], + 'frameworkSlug': 'g-cloud-6', + 'lotSlug': 'g-lot', + 'sectionSlug': 'section-slug', + }, 'updated_by': 'user', - 'evaluatorQuestions': {'question': 'answer'} } - def test_update_assigned_evaluators_for_question(self, data_client, rmock): + def test_get_evaluator_framework_lot_section_evaluation(self, data_client, rmock): + rmock.get( + "http://baseurl/evaluations/evaluator-framework-lot-section-evaluations/1234", + json={"evaluatorFrameworkLotSectionEvaluations": "result"}, + status_code=200) + + result = data_client.get_evaluator_framework_lot_section_evaluation(1234) + + assert result == {"evaluatorFrameworkLotSectionEvaluations": "result"} + assert rmock.called + + def test_create_evaluator_framework_lot_section_evaluation(self, data_client, rmock): rmock.post( - "http://baseurl/evaluator-questions/g-cloud-6/g-lot/1234/theQuestion", + "http://baseurl/evaluations/evaluator-framework-lot-section-evaluations", json={"message": "done"}, status_code=200 ) - result = data_client.update_assigned_evaluators_for_question( - 'g-cloud-6', - 'g-lot', + result = data_client.create_evaluator_framework_lot_section_evaluation( 1234, - 'theQuestion', + 5678, + { + "comment": "This is the comment", + "score": "50" + }, [ - 123, - 456 + "comment", + "score" ], 'user' ) @@ -4236,11 +4180,41 @@ def test_update_assigned_evaluators_for_question(self, data_client, rmock): assert result == {'message': 'done'} assert rmock.called assert rmock.request_history[0].json() == { - 'evaluatorQuestions': { - 'users': [ - 123, - 456 - ], + 'evaluatorFrameworkLotSectionId': 1234, + 'supplierId': 5678, + 'evaluatorFrameworkLotSectionEvaluations': { + "comment": "This is the comment", + "score": "50" + }, + 'page_questions': [ + "comment", + "score" + ], + 'updated_by': 'user', + } + + def test_update_evaluator_framework_lot_section_evaluation(self, data_client, rmock): + rmock.post( + "http://baseurl/evaluations/evaluator-framework-lot-section-evaluations/1234", + json={"message": "done"}, + status_code=200 + ) + + result = data_client.update_evaluator_framework_lot_section_evaluation( + 1234, + { + "comment": "This is the comment", + "score": "50" + }, + 'user' + ) + + assert result == {'message': 'done'} + assert rmock.called + assert rmock.request_history[0].json() == { + 'evaluatorFrameworkLotSectionEvaluations': { + "comment": "This is the comment", + "score": "50" }, 'updated_by': 'user', }