Showing
3 changed files
with
30 additions
and
16 deletions
... | ... | @@ -698,25 +698,33 @@ def test_bid_data_selection(data, index): |
698 | 698 | return bid |
699 | 699 | |
700 | 700 | |
701 | -def test_bid_data_pq(data, over_limit): | |
701 | +def test_bid_data_pq(data, over_limit=False, missing_criteria=False, more_than_two_requirements=False, invalid_expected_value=False): | |
702 | 702 | bid = test_bid_data() |
703 | 703 | bid.data.requirementResponses = [] |
704 | - for criteria in data['criteria']: | |
705 | - for requirements in criteria['requirementGroups']: | |
706 | - for requirement in requirements['requirements']: | |
707 | - if requirement.get('expectedValue'): | |
708 | - value = requirement.get('expectedValue') | |
709 | - else: | |
710 | - value = fake.random_int(min=int(requirement.get('minValue')), max=int(data['value']['amount'])) | |
711 | - requirement = { | |
712 | - "requirement": {"id": requirement['id']}, | |
713 | - "value": value | |
714 | - } | |
715 | - bid.data.requirementResponses.append(requirement) | |
704 | + if 'criteria' in data: | |
705 | + for criteria in data['criteria']: | |
706 | + for requirements in criteria['requirementGroups']: | |
707 | + for requirement in requirements['requirements']: | |
708 | + if requirement.get('expectedValue'): | |
709 | + value = requirement.get('expectedValue') | |
710 | + if invalid_expected_value: | |
711 | + value = "invalid_value" | |
712 | + else: | |
713 | + value = fake.random_int(min=int(requirement.get('minValue')), max=int(data['value']['amount'])) | |
714 | + requirement = { | |
715 | + "requirement": {"id": requirement['id']}, | |
716 | + "value": value | |
717 | + } | |
718 | + bid.data.requirementResponses.append(requirement) | |
719 | + if not more_than_two_requirements: | |
720 | + break | |
716 | 721 | bid.data['status'] = 'draft' |
717 | - bid.data.update(test_bid_value(fake.random_int(min=1, max=int(data['value']['amount'])), data['value']['valueAddedTaxIncluded'])) | |
722 | + bid.data.update(test_bid_value(fake.random_int(min=1, max=int(data['value']['amount'])), | |
723 | + data['value']['valueAddedTaxIncluded'])) | |
718 | 724 | if over_limit: |
719 | 725 | bid.data['value']['amount'] = int(data['value']['amount']) + fake.random_int(min=1, max=1000) |
726 | + if missing_criteria: | |
727 | + del bid['data']['requirementResponses'][-1] | |
720 | 728 | return bid |
721 | 729 | |
722 | 730 | ... | ... |
... | ... | @@ -353,7 +353,14 @@ Get Broker Property By Username |
353 | 353 | Підготувати дані для подання пропозиції priceQuotation |
354 | 354 | [Arguments] ${username} |
355 | 355 | ${BID_OVER_LIMIT}= Get Variable Value ${BID_OVER_LIMIT} ${False} |
356 | - ${bid}= test_bid_data_pq ${USERS.users['${username}'].tender_data.data} ${BID_OVER_LIMIT} | |
356 | + ${BID_ONE_OF_THE_CRITERIAS_IS_MISSING}= Get Variable Value ${BID_ONE_OF_THE_CRITERIAS_IS_MISSING} ${False} | |
357 | + ${BID_SAME_GROUPS_DIFFERENT_CRITERIA}= Get Variable Value ${BID_SAME_GROUPS_DIFFERENT_CRITERIA} ${False} | |
358 | + ${BID_INVALID_EXPECTED_VALUE}= Get Variable Value ${BID_INVALID_EXPECTED_VALUE} ${False} | |
359 | + ${bid}= test_bid_data_pq ${USERS.users['${username}'].tender_data.data} | |
360 | + ... ${BID_OVER_LIMIT} | |
361 | + ... ${BID_ONE_OF_THE_CRITERIAS_IS_MISSING} | |
362 | + ... ${BID_SAME_GROUPS_DIFFERENT_CRITERIA} | |
363 | + ... ${BID_INVALID_EXPECTED_VALUE} | |
357 | 364 | [Return] ${bid} |
358 | 365 | |
359 | 366 | ... | ... |
Please
register
or
login
to post a comment