Пример #1
0
def test_responderProcessing_add_new_documents_object(
        host, port, prepared_cpid, prepare_data, prepared_entity_id,
        execute_insert_into_access_tender, payload_responderProcessing,
        prepared_token_entity, prepared_owner, response,
        execute_select_access_tenders_by_cpid):
    cpid = prepared_cpid
    token = prepared_token_entity
    owner = prepared_owner
    data = prepare_data(schema=schema_tender)
    data['ocid'] = cpid
    identifier = prepare_data(schema=schema_identifier)
    business_function = prepare_data(schema=schema_businessFunction)
    document = prepare_data(schema=schema_document)
    data['tender']['procuringEntity']['persones'][0]['businessFunctions'][
        0] = business_function
    data_document = business_function['documents'][0]
    data['tender']['procuringEntity']['persones'][0]['identifier'] = identifier

    execute_insert_into_access_tender(cp_id=cpid,
                                      stage="EV",
                                      token_entity=token,
                                      created_date=datetime.now(),
                                      json_data=data,
                                      owner=owner)

    responder = prepare_data(schema=schema_responder)
    responder['identifier'] = identifier
    responder['businessFunctions'][0] = business_function
    responder['businessFunctions'][0]['documents'][0] = document
    responder_document = responder['businessFunctions'][0]['documents'][0]
    responder_document['id'] = str(prepared_entity_id())
    date = ocds_datetime()
    payload = payload_responderProcessing(cpid=cpid,
                                          responder=responder,
                                          date=date)
    actualresult = requests.post(f'{host}:{port.eAccess}/command2',
                                 json=payload).json()
    response.success['result'] = {
        "name": responder['name'],
        "identifier": {
            "id": responder['identifier']['id'],
            "scheme": responder['identifier']['scheme']
        }
    }

    assert actualresult == response.success

    record = execute_select_access_tenders_by_cpid(cp_id=cpid).one()

    assert record.created_date == ocds_date_to_datetime(date)

    json_data = json.loads(record.json_data)
    record_businessFunction = json_data['tender']['procuringEntity'][
        'persones'][0]['businessFunctions'][0]

    assert record_businessFunction['documents'] == [
        data_document, responder_document
    ]
Пример #2
0
def test_responderProcessing_without_documents_description_if_persones_does_not_present_in_DB(
        host, port, prepared_cpid, prepare_data,
        execute_insert_into_access_tender, prepared_token_entity,
        prepared_owner, response, payload_responderProcessing,
        execute_select_access_tenders_by_cpid):
    cpid = prepared_cpid
    token = prepared_token_entity
    owner = prepared_owner
    identifier = prepare_data(schema=schema_identifier)
    data = prepare_data(schema=schema_tender)
    data['ocid'] = cpid
    business_function = prepare_data(schema=schema_businessFunction)
    data['tender']['procuringEntity']['persones'][0]['identifier'] = identifier
    data['tender']['procuringEntity']['persones'][0]['businessFunctions'][
        0] = business_function

    del business_function['documents']
    execute_insert_into_access_tender(cp_id=cpid,
                                      stage="EV",
                                      token_entity=token,
                                      created_date=datetime.now(),
                                      json_data=data,
                                      owner=owner)

    responder = prepare_data(schema=schema_responder)
    responder['identifier'] = identifier
    responder['businessFunctions'][0] = prepare_data(
        schema=schema_businessFunction)
    del responder['businessFunctions'][0]['documents'][0]['description']
    date = ocds_datetime()
    payload = payload_responderProcessing(cpid=cpid,
                                          responder=responder,
                                          date=date)
    actualresult = requests.post(f'{host}:{port.eAccess}/command2',
                                 json=payload).json()
    response.success['result'] = {
        "name": responder['name'],
        "identifier": {
            "id": responder['identifier']['id'],
            "scheme": responder['identifier']['scheme']
        }
    }

    assert actualresult == response.success

    record = execute_select_access_tenders_by_cpid(cp_id=cpid).one()

    assert record.created_date == ocds_date_to_datetime(date)
    json_data = json.loads(record.json_data)
    record_person = json_data['tender']['procuringEntity']['persones'][0]

    assert record_person == responder
Пример #3
0
def test_responderProcessing_update_businessFunction(
        host, port, prepared_cpid, prepare_data, prepared_owner,
        execute_insert_into_access_tender, prepared_token_entity,
        payload_responderProcessing, response,
        execute_select_access_tenders_by_cpid):
    cpid = prepared_cpid
    data = prepare_data(schema=schema_tender)
    data['ocid'] = cpid
    identifier = prepare_data(schema=schema_identifier)
    token = prepared_token_entity
    owner = prepared_owner
    business_function = prepare_data(schema=schema_businessFunction)
    data['tender']['procuringEntity']['persones'][0]['identifier'] = identifier
    data['tender']['procuringEntity']['persones'][0]['businessFunctions'][
        0] = business_function

    execute_insert_into_access_tender(cp_id=cpid,
                                      stage="EV",
                                      token_entity=token,
                                      created_date=datetime.now(),
                                      json_data=data,
                                      owner=owner)

    responder = prepare_data(schema=schema_responder)
    responder['identifier'] = identifier
    responder['businessFunctions'][0] = business_function
    business_function['type'] = "technicalOpener"
    business_function['jobTitle'] = "tat_4to-4to"
    business_function['period']['startDate'] = ocds_datetime()
    date = ocds_datetime()

    payload = payload_responderProcessing(cpid=cpid,
                                          responder=responder,
                                          date=date)
    actualresult = requests.post(f'{host}:{port.eAccess}/command2',
                                 json=payload).json()
    response.success['result'] = {
        "name": responder['name'],
        "identifier": {
            "id": responder['identifier']['id'],
            "scheme": responder['identifier']['scheme']
        }
    }

    assert actualresult == response.success

    record = execute_select_access_tenders_by_cpid(cp_id=cpid).one()
    assert record.created_date == ocds_date_to_datetime(date)
    json_data = json.loads(record.json_data)
    record_person = json_data['tender']['procuringEntity']['persones'][0]

    assert record_person['businessFunctions'][0] == business_function
Пример #4
0
def test_responderProcessing_return_the_created_responder_object_in_the_response(
        host, port, prepared_cpid, prepare_data, prepared_token_entity,
        execute_insert_into_access_tender, prepared_owner, response,
        payload_responderProcessing, execute_select_access_tenders_by_cpid):
    cpid = prepared_cpid
    token = prepared_token_entity
    owner = prepared_owner
    data = prepare_data(schema=schema_tender)
    data['ocid'] = cpid

    execute_insert_into_access_tender(cp_id=cpid,
                                      stage="EV",
                                      token_entity=token,
                                      created_date=datetime.now(),
                                      json_data=data,
                                      owner=owner)

    responder = prepare_data(schema=schema_responder)

    name = responder['name']
    identifier_id = responder['identifier']['id']
    identifier_scheme = responder['identifier']['scheme']
    date = ocds_datetime()
    payload = payload_responderProcessing(cpid=cpid,
                                          responder=responder,
                                          date=date)
    actualresult = requests.post(f'{host}:{port.eAccess}/command2',
                                 json=payload).json()

    response.success['result'] = {
        "name": responder['name'],
        "identifier": {
            "id": responder['identifier']['id'],
            "scheme": responder['identifier']['scheme']
        }
    }
    assert actualresult == response.success
    assert response.success['result']['name'] == name
    assert response.success['result']['identifier']['id'] == identifier_id
    assert response.success['result']['identifier'][
        'scheme'] == identifier_scheme

    record = execute_select_access_tenders_by_cpid(cp_id=cpid).one()

    assert record.created_date == ocds_date_to_datetime(date)
    json_data = json.loads(record.json_data)
    record_person = json_data['tender']['procuringEntity']['persones'][0]

    assert record_person == responder
Пример #5
0
def test_responderProcessing_new_persones_object(
        host, port, prepared_cpid, prepare_data, prepared_owner,
        execute_insert_into_access_tender, payload_responderProcessing,
        prepared_entity_id, prepared_token_entity, response,
        execute_select_access_tenders_by_cpid):
    cpid = prepared_cpid
    data = prepare_data(schema=schema_tender)
    data['ocid'] = cpid
    data_person = data['tender']['procuringEntity']['persones'][0]
    token = prepared_token_entity
    owner = prepared_owner
    execute_insert_into_access_tender(cp_id=cpid,
                                      stage="EV",
                                      token_entity=token,
                                      created_date=datetime.now(),
                                      json_data=data,
                                      owner=owner)

    responder = prepare_data(schema=schema_responder)
    responder['identifier']['id'] = str(prepared_entity_id())
    responder['identifier']['scheme'] = "UA-NEDNO"
    date = ocds_datetime()

    payload = payload_responderProcessing(cpid=cpid,
                                          responder=responder,
                                          date=date)
    actualresult = requests.post(f'{host}:{port.eAccess}/command2',
                                 json=payload).json()
    response.success['result'] = {
        "name": responder['name'],
        "identifier": {
            "id": responder['identifier']['id'],
            "scheme": responder['identifier']['scheme']
        }
    }

    assert actualresult == response.success

    record = execute_select_access_tenders_by_cpid(cp_id=cpid).one()
    assert record.created_date == ocds_date_to_datetime(date)
    json_data = json.loads(record.json_data)
    record_procuring_entity = json_data['tender']['procuringEntity']

    assert record_procuring_entity['persones'] == [data_person, responder]
def test_closeAwardPeriod_with_valid_params_and_awardPeriod_in_db(
        port, host, payload_closeAwardPeriod,
        execute_insert_into_evaluation_period,
        execute_select_evaluation_period_by_cpid, prepared_cpid, response):
    cp_id = prepared_cpid
    end_date = ocds_datetime()
    execute_insert_into_evaluation_period(cp_id=cp_id,
                                          stage='EV',
                                          start_date=datetime.now())
    payload = payload_closeAwardPeriod(cpid=prepared_cpid, endDate=end_date)
    actualresult = requests.post(f'{host}:{port.eEvaluation}/command2',
                                 json=payload).json()
    response.success['result'] = {'awardPeriod': {'endDate': end_date}}
    assert actualresult == response.success

    record = execute_select_evaluation_period_by_cpid(
        cp_id=prepared_cpid).one()

    assert record.end_date == ocds_date_to_datetime(end_date)