Ejemplo n.º 1
0
def resource_factory():
    return {
        "resource_group_id": str(uuid4()),
        "cache_last_updated": None,
        "revision_timestamp": "2013-10-01T15:59:56.322481",
        "webstore_last_updated": "2013-10-01T17:59:56.238951",
        "id": str(uuid4()),
        "size": "1375",
        "state": "active",
        "hash": "689afc083c6316259955f499580bdf41bfc5e495",
        "description": faker.paragraph(),
        "format": "CSV",
        "tracking_summary": {
            "total": 0,
            "recent": 0
        },
        "mimetype_inner": None,
        "mimetype": "text/csv",
        "cache_url": None,
        "name": faker.sentence(),
        "created": "2013-08-01T09:43:09.031465",
        "url": faker.url(),
        "webstore_url": "active",
        "last_modified": "2013-10-01T17:59:55.552785",
        "position": 0,
        "revision_id": str(uuid4()),
        "resource_type": "file.upload"
    }
Ejemplo n.º 2
0
def resource_factory():
    return {
        "resource_group_id": str(uuid4()),
        "cache_last_updated": None,
        "revision_timestamp": "2013-10-01T15:59:56.322481",
        "webstore_last_updated": "2013-10-01T17:59:56.238951",
        "id": str(uuid4()),
        "size": "1375",
        "state": "active",
        "hash": "689afc083c6316259955f499580bdf41bfc5e495",
        "description": faker.paragraph(),
        "format": "CSV",
        "tracking_summary": {
            "total": 0,
            "recent": 0
        },
        "mimetype_inner": None,
        "mimetype": "text/csv",
        "cache_url": None,
        "name": faker.sentence(),
        "created": "2013-08-01T09:43:09.031465",
        "url": faker.url(),
        "webstore_url": "active",
        "last_modified": "2013-10-01T17:59:55.552785",
        "position": 0,
        "revision_id": str(uuid4()),
        "resource_type": "file.upload"
    }
Ejemplo n.º 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())
        }
    }
Ejemplo n.º 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())
        }
    }