def test_compare_ev_release_before_updating_and_after_updating_27609_3( self): ev_release_after_lot_amendment_cancellation = requests.get( url=f"{CancelLotAmendment.message_from_kafka['data']['url']}" ).json() before_lot_amendment_cancellation = CancelLotAmendment.ev_release_before_lot_amendment_cancellation expected_result = { 'values_changed': { "root['releases'][0]['id']": { 'new_value': f"{ev_release_after_lot_amendment_cancellation['releases'][0]['ocid']}-" f"{ev_release_after_lot_amendment_cancellation['releases'][0]['id'][46:59]}", 'old_value': f"{before_lot_amendment_cancellation['releases'][0]['ocid']}-" f"{before_lot_amendment_cancellation['releases'][0]['id'][46:59]}" }, "root['releases'][0]['date']": { 'new_value': ev_release_after_lot_amendment_cancellation['releases'][0] ['date'], 'old_value': before_lot_amendment_cancellation['releases'][0]['date'] }, "root['releases'][0]['tender']['amendments'][0]['status']": { 'new_value': 'cancelled', 'old_value': 'pending' } } } actual_result = DeepDiff( CancelLotAmendment.ev_release_before_lot_amendment_cancellation, ev_release_after_lot_amendment_cancellation) previous_amendments = before_lot_amendment_cancellation['releases'][0][ 'tender']['amendments'] actual_amendments = ev_release_after_lot_amendment_cancellation[ 'releases'][0]['tender']['amendments'] expected_amendments = [{ "id": previous_amendments[0]['id'], "type": "cancellation", "status": "cancelled", "relatesTo": "lot", "relatedItem": CancelLotAmendment.lot_id, "date": previous_amendments[0]['date'], "description": previous_amendments[0]['description'], "rationale": previous_amendments[0]['rationale'], "documents": [{ "id": previous_amendments[0]['documents'][0]['id'], "documentType": previous_amendments[0]['documents'][0]['documentType'], "title": previous_amendments[0]['documents'][0]['title'], "description": previous_amendments[0]['documents'][0]['description'], "url": previous_amendments[0]['documents'][0]['url'], "datePublished": previous_amendments[0]['documents'][0]['datePublished'] }] }] assert compare_actual_result_and_expected_result( expected_result=str(expected_result), actual_result=str(actual_result)) assert compare_actual_result_and_expected_result( expected_result=str(expected_amendments), actual_result=str(actual_amendments))
def test_test_send_the_request_27610_1(self, country, language, instance, cassandra_username, cassandra_password, pmd): instance = instance first_lot_id = f"{uuid4()}" second_lot_id = f"{uuid4()}" first_item_id = f"{uuid4()}" second_item_id = f"{uuid4()}" cancel_tender = CancelTender(lang=language, country=country, instance=instance, cassandra_username=cassandra_username, cassandra_password=cassandra_password, pmd=pmd) cancel_lot_response = cancel_tender.insert_cancel_lot_obligatory( first_lot_id=first_lot_id, second_lot_id=second_lot_id, first_item_id=first_item_id, second_item_id=second_item_id, second_enquiry=121, second_tender=300, lot_id=first_lot_id) CancelLotAmendment.ms_release_before_lot_amendment_cancellation = requests.get( url=cancel_lot_response[5]).json() CancelLotAmendment.pn_release_before_lot_amendment_cancellation = requests.get( url=cancel_lot_response[6]).json() CancelLotAmendment.ev_release_before_lot_amendment_cancellation = requests.get( url=cancel_lot_response[7]).json() lot_amendment_cancellation_response = cancel_tender.tender_amendment_cancellation( cp_id=cancel_lot_response[0], ev_id=cancel_lot_response[3]) CancelLotAmendment.message_from_kafka = cancel_tender.get_message_from_kafka( ) CancelLotAmendment.successfully_lot_amendment_cancellation = cancel_tender. \ check_on_that_message_is_successfully_tender_amendment_cancellation( cp_id=cancel_lot_response[0], ev_id=cancel_lot_response[3] ) instance_tender_url = None instance_budget_url = None instance_storage_url = None if instance == "dev": instance_tender_url = "http://dev.public.eprocurement.systems/tenders/" instance_budget_url = "http://dev.public.eprocurement.systems/budgets/" instance_storage_url = "https://dev.bpe.eprocurement.systems/api/v1/storage/get/" if instance == "sandbox": instance_tender_url = "http://public.eprocurement.systems/tenders/" instance_budget_url = "http://public.eprocurement.systems/budgets/" instance_storage_url = "http://storage.eprocurement.systems/get/" CancelLotAmendment.instance_tender_url = instance_tender_url CancelLotAmendment.instance_budget_url = instance_budget_url CancelLotAmendment.instance_storage_url = instance_storage_url CancelLotAmendment.cp_id = cancel_lot_response[0] CancelLotAmendment.ev_id = cancel_lot_response[3] CancelLotAmendment.pn_id = cancel_lot_response[1] CancelLotAmendment.lot_id = first_lot_id CancelLotAmendment.amendment_id = cancel_lot_response[8] CancelLotAmendment.amendment_token = cancel_lot_response[9] assert compare_actual_result_and_expected_result( expected_result=str(202), actual_result=str(lot_amendment_cancellation_response.status_code))
def test_see_result_from_feed_point_27600_2(self): assert compare_actual_result_and_expected_result( expected_result=str(True), actual_result=str(CancelCn.successfully_cancel_tender) )
def test_see_result_from_feed_point_27609_2(self): assert compare_actual_result_and_expected_result( expected_result=str(True), actual_result=str( CancelLotAmendment.successfully_lot_amendment_cancellation))
def test_test_send_the_request_27600_1(self, country, language, instance, cassandra_username, cassandra_password, pmd): instance = instance first_lot_id = f"{uuid4()}" second_lot_id = f"{uuid4()}" first_item_id = f"{uuid4()}" second_item_id = f"{uuid4()}" document = Document(instance=instance) document_one_was_uploaded = document.uploading_document()[0]["data"]["id"] payload = copy.deepcopy(cancel_tender_or_lot_payload_full_data_model) payload['amendments'][0]['documents'][0]['id'] = document_one_was_uploaded cancel_tender = CancelTender( payload=payload, lang=language, country=country, instance=instance, cassandra_username=cassandra_username, cassandra_password=cassandra_password, pmd=pmd ) create_ev_response = cancel_tender.insert_cnonpn_full( first_lot_id=first_lot_id, second_lot_id=second_lot_id, first_item_id=first_item_id, second_item_id=second_item_id, second_enquiry=121, second_tender=300 ) CancelCn.ms_release_before_tender_cancelling = requests.get(url=create_ev_response[5]).json() CancelCn.pn_release_before_tender_cancelling = requests.get(url=create_ev_response[6]).json() CancelCn.ev_release_before_tender_cancelling = requests.get(url=create_ev_response[7]).json() cancel_tender_response = cancel_tender.cancel_tender( cp_id=create_ev_response[0], ev_id=create_ev_response[3], pn_token=create_ev_response[2] ) CancelCn.message_from_kafka = cancel_tender.get_message_from_kafka() CancelCn.successfully_cancel_tender = cancel_tender.check_on_that_message_is_successfully_cancel_tender( cp_id=create_ev_response[0], ev_id=create_ev_response[3] ) instance_tender_url = None instance_budget_url = None instance_storage_url = None if instance == "dev": instance_tender_url = "http://dev.public.eprocurement.systems/tenders/" instance_budget_url = "http://dev.public.eprocurement.systems/budgets/" instance_storage_url = "https://dev.bpe.eprocurement.systems/api/v1/storage/get/" if instance == "sandbox": instance_tender_url = "http://public.eprocurement.systems/tenders/" instance_budget_url = "http://public.eprocurement.systems/budgets/" instance_storage_url = "http://storage.eprocurement.systems/get/" CancelCn.instance_tender_url = instance_tender_url CancelCn.instance_budget_url = instance_budget_url CancelCn.instance_storage_url = instance_storage_url CancelCn.payload = payload CancelCn.cp_id = create_ev_response[0] CancelCn.ev_id = create_ev_response[3] CancelCn.pn_id = create_ev_response[1] assert compare_actual_result_and_expected_result( expected_result=str(202), actual_result=str(cancel_tender_response.status_code) )
def test_compare_pn_release_before_cancelling_and_after_cancelling_27591_3( self, country, language, instance, cassandra_username, cassandra_password, pmd): first_lot_id = f"{uuid4()}" second_lot_id = f"{uuid4()}" first_item_id = f"{uuid4()}" second_item_id = f"{uuid4()}" document = Document(instance=instance) document_one_was_uploaded = document.uploading_document()[0]["data"]["id"] document_two_was_uploaded = document.uploading_document()[0]["data"]["id"] pn = PN( payload=None, lang=language, country=country, instance=instance, cassandra_username=cassandra_username, cassandra_password=cassandra_password, pmd=pmd, document_one_id=document_one_was_uploaded, document_two_id=document_two_was_uploaded ) create_pn_response = pn.insert_pn_full_( first_lot_id=first_lot_id, second_lot_id=second_lot_id, first_item_id=first_item_id, second_item_id=second_item_id ) pn_release_before_cancelling = requests.get(url=create_pn_response[9]).json() pn.cancel_pn( cp_id=create_pn_response[4], pn_id=create_pn_response[5], pn_token=create_pn_response[6] ) cancel_pn_response = pn.get_message_from_kafka() pn_record_after_cancelling = requests.get(url=cancel_pn_response['data']['url']).json()['records'] actual_releases_list = list() for d in pn_record_after_cancelling: for d_1 in d["compiledRelease"]["relatedProcesses"]: if d_1["relationship"] == ["planning"]: actual_releases_list.append(d_1) pn_release_after_cancelling = requests.get(url=actual_releases_list[0]["uri"]).json() expected_result = { 'values_changed': { "root['releases'][0]['id']": { 'new_value': f"{pn_release_after_cancelling['releases'][0]['ocid']}-" f"{pn_release_after_cancelling['releases'][0]['id'][46:59]}", 'old_value': f"{pn_release_before_cancelling['releases'][0]['ocid']}-" f"{pn_release_before_cancelling['releases'][0]['id'][46:59]}" }, "root['releases'][0]['date']": { 'new_value': pn_release_after_cancelling['releases'][0]['date'], 'old_value': pn_release_before_cancelling['releases'][0]['date'] }, "root['releases'][0]['tag'][0]": { 'new_value': pn_release_after_cancelling['releases'][0]['tag'][0], 'old_value': pn_release_before_cancelling['releases'][0]['tag'][0] }, "root['releases'][0]['tender']['status']": { 'new_value': pn_release_after_cancelling['releases'][0]['tender']['status'], 'old_value': pn_release_before_cancelling['releases'][0]['tender']['status'] }, "root['releases'][0]['tender']['statusDetails']": { 'new_value': pn_release_after_cancelling['releases'][0]['tender']['statusDetails'], 'old_value': pn_release_before_cancelling['releases'][0]['tender']['statusDetails'] }, "root['releases'][0]['tender']['lots'][0]['status']": { 'new_value': pn_release_after_cancelling['releases'][0]['tender']['lots'][0]['status'], 'old_value': pn_release_before_cancelling['releases'][0]['tender']['lots'][0]['status'] }, "root['releases'][0]['tender']['lots'][1]['status']": { 'new_value': pn_release_after_cancelling['releases'][0]['tender']['lots'][1]['status'], 'old_value': pn_release_before_cancelling['releases'][0]['tender']['lots'][1]['status'] } } } actual_result = DeepDiff(pn_release_before_cancelling, pn_release_after_cancelling) assert compare_actual_result_and_expected_result( expected_result=str(expected_result), actual_result=str(actual_result) )
def test_test_send_the_request_27608_1(self, country, language, instance, cassandra_username, cassandra_password, pmd): first_lot_id = f"{uuid4()}" second_lot_id = f"{uuid4()}" first_item_id = f"{uuid4()}" second_item_id = f"{uuid4()}" payload = copy.deepcopy(cancel_tender_or_lot_payload_obligatory_data_model) cancel_tender = CancelTender( payload=payload, lang=language, country=country, instance=instance, cassandra_username=cassandra_username, cassandra_password=cassandra_password, pmd=pmd ) create_ev_response = cancel_tender.insert_cnonpn_obligatory( first_lot_id=first_lot_id, second_lot_id=second_lot_id, first_item_id=first_item_id, second_item_id=second_item_id, second_enquiry=121, second_tender=300 ) CancelLot.ms_release_before_lot_cancelling = requests.get(url=create_ev_response[5]).json() CancelLot.pn_release_before_lot_cancelling = requests.get(url=create_ev_response[6]).json() CancelLot.ev_release_before_lot_cancelling = requests.get(url=create_ev_response[7]).json() cancel_lot_response = cancel_tender.cancel_lot( cp_id=create_ev_response[0], ev_id=create_ev_response[3], pn_token=create_ev_response[2], lot_id=first_lot_id ) CancelLot.message_from_kafka = cancel_tender.get_message_from_kafka() CancelLot.successfully_cancel_lot = cancel_tender.check_on_that_message_is_successfully_cancel_tender( cp_id=create_ev_response[0], ev_id=create_ev_response[3] ) instance_tender_url = None instance_budget_url = None instance_storage_url = None if instance == "dev": instance_tender_url = "http://dev.public.eprocurement.systems/tenders/" instance_budget_url = "http://dev.public.eprocurement.systems/budgets/" instance_storage_url = "https://dev.bpe.eprocurement.systems/api/v1/storage/get/" if instance == "sandbox": instance_tender_url = "http://public.eprocurement.systems/tenders/" instance_budget_url = "http://public.eprocurement.systems/budgets/" instance_storage_url = "http://storage.eprocurement.systems/get/" CancelLot.instance_tender_url = instance_tender_url CancelLot.instance_budget_url = instance_budget_url CancelLot.instance_storage_url = instance_storage_url CancelLot.payload = payload CancelLot.cp_id = create_ev_response[0] CancelLot.ev_id = create_ev_response[3] CancelLot.pn_id = create_ev_response[1] CancelLot.lot_id = first_lot_id assert compare_actual_result_and_expected_result( expected_result=str(202), actual_result=str(cancel_lot_response.status_code) )
def test_compare_ev_release_before_updating_and_after_updating_27602_3( self): ev_release_after_tender_amendment_confirmation = requests.get( url=f"{ConfirmTenderAmendment.message_from_kafka['data']['url']}" ).json() before_amendment_confirmation = ConfirmTenderAmendment.ev_release_before_tender_amendment_confirmation expected_result = { 'dictionary_item_added': "['releases'][0]['awards']", 'values_changed': { "root['releases'][0]['id']": { 'new_value': f"{ev_release_after_tender_amendment_confirmation['releases'][0]['ocid']}-" f"{ev_release_after_tender_amendment_confirmation['releases'][0]['id'][46:59]}", 'old_value': f"{before_amendment_confirmation['releases'][0]['ocid']}-" f"{before_amendment_confirmation['releases'][0]['id'][46:59]}" }, "root['releases'][0]['date']": { 'new_value': ev_release_after_tender_amendment_confirmation['releases'] [0]['date'], 'old_value': before_amendment_confirmation['releases'][0]['date'] }, "root['releases'][0]['tender']['status']": { 'new_value': 'cancelled', 'old_value': 'active' }, "root['releases'][0]['tender']['statusDetails']": { 'new_value': 'empty', 'old_value': 'clarification' }, "root['releases'][0]['tender']['lots'][0]['status']": { 'new_value': 'cancelled', 'old_value': 'active' }, "root['releases'][0]['tender']['lots'][1]['status']": { 'new_value': 'cancelled', 'old_value': 'active' }, "root['releases'][0]['tender']['amendments'][0]['status']": { 'new_value': 'active', 'old_value': 'pending' } } } actual_result = DeepDiff( ConfirmTenderAmendment. ev_release_before_tender_amendment_confirmation, ev_release_after_tender_amendment_confirmation) dictionary_item_added_was_cleaned = str( actual_result['dictionary_item_added']).replace('root', '')[1:-1] actual_result[ 'dictionary_item_added'] = dictionary_item_added_was_cleaned actual_awards = ev_release_after_tender_amendment_confirmation[ 'releases'][0]['awards'] expected_awards = [{ "id": actual_awards[0]['id'], "title": "Lot is not awarded", "description": "Other reasons (discontinuation of procedure)", "status": "unsuccessful", "statusDetails": "lotCancelled", "date": ConfirmTenderAmendment.message_from_kafka['data']['operationDate'], "relatedLots": [ before_amendment_confirmation['releases'][0]['tender']['lots'] [0]['id'] ] }, { "id": actual_awards[1]['id'], "title": "Lot is not awarded", "description": "Other reasons (discontinuation of procedure)", "status": "unsuccessful", "statusDetails": "lotCancelled", "date": ConfirmTenderAmendment.message_from_kafka['data']['operationDate'], "relatedLots": [ before_amendment_confirmation['releases'][0]['tender']['lots'] [1]['id'] ] }] assert compare_actual_result_and_expected_result( expected_result=str(expected_result), actual_result=str(actual_result)) assert compare_actual_result_and_expected_result( expected_result=str(expected_awards), actual_result=str(actual_awards))
def test_see_result_from_feed_point_27602_2(self): assert compare_actual_result_and_expected_result( expected_result=str(True), actual_result=str(ConfirmTenderAmendment. successfully_tender_amendment_confirmation))