|
@@ -698,25 +698,33 @@ def test_bid_data_selection(data, index): |
|
@@ -698,25 +698,33 @@ def test_bid_data_selection(data, index): |
698
|
return bid
|
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
|
bid = test_bid_data()
|
702
|
bid = test_bid_data()
|
703
|
bid.data.requirementResponses = []
|
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
|
bid.data['status'] = 'draft'
|
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
|
if over_limit:
|
724
|
if over_limit:
|
719
|
bid.data['value']['amount'] = int(data['value']['amount']) + fake.random_int(min=1, max=1000)
|
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
|
return bid
|
728
|
return bid
|
721
|
|
729
|
|
722
|
|
730
|
|