Commit 9c5959ad30fb6b2c50290ab955009fd369325373

Authored by ivanka12
1 parent c7c71145

add function to generate data for dasu

... ... @@ -19,9 +19,12 @@ fake_uk = Factory.create(locale='uk_UA')
19 19 fake_uk.add_provider(OP_Provider)
20 20 fake = fake_uk
21 21 used_identifier_id = []
22   -mode_open = ["belowThreshold", "aboveThresholdUA", "aboveThresholdEU",
23   - "aboveThresholdUA.defense", "competitiveDialogueUA", "competitiveDialogueEU", "esco"]
24   -mode_limited = ["reporting", "negotiation.quick", "negotiation"]
  22 +mode_open = ["belowThreshold", "aboveThresholdUA", "aboveThresholdEU",
  23 + "aboveThresholdUA.defense", "competitiveDialogueUA", "competitiveDialogueEU", "esco"]
  24 +mode_limited = ["reporting", "negotiation.quick", "negotiation"]
  25 +violationType = ["corruptionDescription", "corruptionProcurementMethodType", "corruptionChanges",
  26 + "corruptionPublicDisclosure", "corruptionBiddingDocuments", "documentsForm",
  27 + "corruptionAwarded", "corruptionCancelled", "corruptionContracting"]
25 28
26 29 # This workaround fixes an error caused by missing "catch_phrase" class method
27 30 # for the "ru_RU" locale in Faker >= 0.7.4
... ... @@ -511,6 +514,7 @@ def test_lot_document_data(document, lot_id):
511 514 document.data.update({"documentOf": "lot", "relatedItem": lot_id})
512 515 return munchify(document)
513 516
  517 +
514 518 def test_change_document_data(document, change_id):
515 519 document.data.update({"documentOf": "change", "relatedItem": change_id})
516 520 return munchify(document)
... ... @@ -588,4 +592,79 @@ def test_change_data():
588 592
589 593
590 594 def get_hash(file_contents):
591   - return ("md5:"+hashlib.md5(file_contents).hexdigest())
\ No newline at end of file
  595 + return ("md5:"+hashlib.md5(file_contents).hexdigest())
  596 +
  597 +
  598 +def tets_monitoring_data( tender_id, accelerator=None):
  599 + data = {
  600 + "reasons": [random.choice(["public", "fiscal", "indicator", "authorities", "media"])],
  601 + "tender_id": tender_id,
  602 + "procuringStages": [random.choice(["awarding", "contracting", "planning"])],
  603 + "parties": [fake.procuringEntity()],
  604 + "decision": {
  605 + "date": get_now().isoformat(),
  606 + "description": fake_en.sentence(nb_words=10, variable_nb_words=True)
  607 + },
  608 + "mode": "test"
  609 + }
  610 + data["parties"][0]["roles"] = [random.choice(["create", "decision", "conclusion"])]
  611 + data["parties"][0]["name"] = "The State Audit Service of Ukraine"
  612 + data['monitoringDetails'] = 'quick, ' \
  613 + 'accelerator={}'.format(accelerator)
  614 + return munchify({'data':data})
  615 +
  616 +
  617 +def test_party(party):
  618 + party["roles"] = "dialogue"
  619 + del party["kind"]
  620 + return munchify({"data":party})
  621 +
  622 +
  623 +def test_dialogue(relatedParty_id):
  624 + return munchify(
  625 + {
  626 + "data":
  627 + {
  628 + "title": fake_en.sentence(nb_words=10, variable_nb_words=True),
  629 + "relatedParty": relatedParty_id,
  630 + "description": fake_en.sentence(nb_words=10, variable_nb_words=True)
  631 + }
  632 + })
  633 +
  634 +
  635 +def test_conclusion(violationOccurred=False):
  636 + return munchify(
  637 + {
  638 + "data": {
  639 + "conclusion": {
  640 + "violationOccurred": violationOccurred,
  641 + "violationType": random.choice(violationType)
  642 + }
  643 + }
  644 + })
  645 +
  646 +
  647 +def test_status_data(status):
  648 + data = {
  649 + "data": {
  650 + "status": status
  651 + }
  652 + }
  653 + if status in ('stopped', 'cancelled'):
  654 + data["data"]["cancellation"] = {}
  655 + data["data"]["cancellation"]["description"] = fake_en.sentence(nb_words=10, variable_nb_words=True)
  656 + return munchify(data)
  657 +
  658 +
  659 +def test_elimination_report(corruption):
  660 + return munchify({
  661 + "data": {
  662 + "eliminationResolution": {
  663 + "resultByType": {
  664 + corruption: random.choice(["eliminated", "not_eliminated", "no_mechanism"])
  665 + },
  666 + "result": random.choice(["completely", "partly", "none"]),
  667 + "description": fake_en.sentence(nb_words=10, variable_nb_words=True)
  668 + }
  669 + }
  670 + })
\ No newline at end of file
... ...
... ... @@ -52,6 +52,12 @@ from .initial_data import (
52 52 test_tender_data_planning,
53 53 test_tender_data_openua_defense,
54 54 test_bid_competitive_data,
  55 + tets_monitoring_data,
  56 + test_party,
  57 + test_dialogue,
  58 + test_conclusion,
  59 + test_status_data,
  60 + test_elimination_report,
55 61 create_fake_title,
56 62 create_fake_value_amount,
57 63 test_change_document_data,
... ...
Please register or login to post a comment