Пример #1
0
def tag_factory(tag):
    timestamp = faker.date_time_between(start_date='-1y', end_date='-1d')
    return {
        "id": str(uuid4()),
        "vocabulary_id": None,
        "display_name": tag,
        "name": tag,
        "revision_timestamp": timestamp.isoformat(),
        "state": "active",
    }
Пример #2
0
def tag_factory(tag):
    timestamp = faker.date_time_between(start_date='-1y', end_date='-1d')
    return {
        "id": str(uuid4()),
        "vocabulary_id": None,
        "display_name": tag,
        "name": tag,
        "revision_timestamp": timestamp.isoformat(),
        "state": "active",
    }
Пример #3
0
def package_show_factory(name):
    org_id = str(uuid4())
    created = faker.date_time_between(start_date='-3y', end_date='-7d')
    updated = faker.date_time_between(start_date='-7d', end_date='now')
    nb_resources = faker.randomize_nb_elements(4)
    nb_tags = faker.randomize_nb_elements(10)
    return {
        "help": "",
        "success": True,
        "result": {
            "license_title":
            "Licence ouverte / Open license (Etalab)",
            "maintainer":
            None,
            "relationships_as_object": [],
            "private":
            False,
            "maintainer_email":
            None,
            "revision_timestamp":
            updated.isoformat(),
            "id":
            str(uuid4()),
            "metadata_created":
            created.isoformat(),
            "owner_org":
            org_id,
            "metadata_modified":
            updated.isoformat(),
            "author":
            None,
            "author_email":
            None,
            "state":
            "active",
            "version":
            None,
            "license_id":
            "lool",
            "type":
            "dataset",
            "resources": [resource_factory() for _ in range(nb_resources)],
            "num_resources":
            nb_resources,
            "tags": [tag_factory(faker.word()) for _ in range(nb_tags)],
            "tracking_summary": {
                "total": 0,
                "recent": 0
            },
            "groups": [{
                "title": " Actions Région",
                "description":
                "Les actions régionales, l'agriculture, l'aménagement du territoire...",
                "name": "actions-region",
                "id": "7859d498-316e-4a31-8487-f7f26df0929e"
            }],
            "relationships_as_subject": [],
            "num_tags":
            nb_tags,
            "name":
            faker.slug(),
            "isopen":
            False,
            "url":
            None,
            "notes":
            faker.paragraph(),
            "title":
            faker.sentence(),
            "extras": [{
                "value": "01/08/2013",
                "key": "date",
                "__extras": {
                    "package_id": "f9f07d12-f810-4cb5-b3c0-52d7b1130c2e",
                    "revision_id": "e108a7c6-0e5f-4714-a8e6-68162c69ae68"
                }
            }, {
                "value": "Annuelle",
                "key": "freqMAJ",
                "__extras": {
                    "revision_id": "e108a7c6-0e5f-4714-a8e6-68162c69ae68",
                    "package_id": "f9f07d12-f810-4cb5-b3c0-52d7b1130c2e"
                }
            }],
            "license_url":
            "http://www.etalab.gouv.fr/pages/Licence_ouverte_Open_licence-5899923.html",
            "organization": {
                "description": "",
                "created": "2013-07-18T11:25:15.969631",
                "title": "Conseil Régional Nord-Pas de Calais",
                "name": "conseil-regional-nord-pas-de-calais",
                "revision_timestamp": "2013-07-29T15:25:28.634142",
                "is_organization": True,
                "state": "active",
                "image_url": "/images/npdc-icon.png",
                "revision_id": str(uuid4()),
                "type": "organization",
                "id": org_id,
                "approval_status": "approved"
            },
            "revision_id":
            str(uuid4())
        }
    }
Пример #4
0
def package_show_factory(name):
    org_id = str(uuid4())
    created = faker.date_time_between(start_date='-3y', end_date='-7d')
    updated = faker.date_time_between(start_date='-7d', end_date='now')
    nb_resources = faker.randomize_nb_elements(4)
    nb_tags = faker.randomize_nb_elements(10)
    return {
        "help": "",
        "success": True,
        "result": {
            "license_title": "Licence ouverte / Open license (Etalab)",
            "maintainer": None,
            "relationships_as_object": [],
            "private": False,
            "maintainer_email": None,
            "revision_timestamp": updated.isoformat(),
            "id": str(uuid4()),
            "metadata_created": created.isoformat(),
            "owner_org": org_id,
            "metadata_modified": updated.isoformat(),
            "author": None,
            "author_email": None,
            "state": "active",
            "version": None,
            "license_id": "lool",
            "type": "dataset",
            "resources": [resource_factory()
                          for _ in range(nb_resources)],
            "num_resources": nb_resources,
            "tags": [tag_factory(faker.word())
                     for _ in range(nb_tags)],
            "tracking_summary": {
                "total": 0,
                "recent": 0
            },
            "groups": [{
                "title": " Actions Région",
                "description": "Les actions régionales, l'agriculture, l'aménagement du territoire...",
                "name": "actions-region",
                "id": "7859d498-316e-4a31-8487-f7f26df0929e"
            }],
            "relationships_as_subject": [],
            "num_tags": nb_tags,
            "name": faker.slug(),
            "isopen": False,
            "url": None,
            "notes": faker.paragraph(),
            "title": faker.sentence(),
            "extras": [{
                "value": "01/08/2013",
                "key": "date",
                "__extras": {
                    "package_id": "f9f07d12-f810-4cb5-b3c0-52d7b1130c2e",
                    "revision_id": "e108a7c6-0e5f-4714-a8e6-68162c69ae68"
                }
            }, {
                "value": "Annuelle",
                "key": "freqMAJ",
                "__extras": {
                    "revision_id": "e108a7c6-0e5f-4714-a8e6-68162c69ae68",
                    "package_id": "f9f07d12-f810-4cb5-b3c0-52d7b1130c2e"
                }
            }],
            "license_url": "http://www.etalab.gouv.fr/pages/Licence_ouverte_Open_licence-5899923.html",
            "organization": {
                "description": "",
                "created": "2013-07-18T11:25:15.969631",
                "title": "Conseil Régional Nord-Pas de Calais",
                "name": "conseil-regional-nord-pas-de-calais",
                "revision_timestamp": "2013-07-29T15:25:28.634142",
                "is_organization": True,
                "state": "active",
                "image_url": "/images/npdc-icon.png",
                "revision_id": str(uuid4()),
                "type": "organization",
                "id": org_id,
                "approval_status": "approved"
            },
            "revision_id": str(uuid4())
        }
    }