def institution_with_id_and_datasets_and_removed_datasets(
        institution_id, num, rm_num):
    org = OrganizationFactory.create(
        id=institution_id,
        title='Institution {} with datasets.'.format(institution_id))
    DatasetFactory.create_batch(num, organization=org)
    DatasetFactory.create_batch(rm_num, organization=org, is_removed=True)
    return org
示例#2
0
def datasets_with_resources_of_type(datasets_data):
    data = json.loads(datasets_data)
    for item in data:
        _dataset = DatasetFactory.create()
        for res_type, res_count in item.items():
            ResourceFactory.create_batch(res_count, dataset=_dataset, type=res_type)
    time.sleep(1)  # time to index data before request is made.
示例#3
0
def showcase_with_id_and_datasets(showcase_id, num):
    showcase = ShowcaseFactory.create(
        id=showcase_id, title='showcase {} with datasets'.format(showcase_id))
    datasets = DatasetFactory.create_batch(num, showcases=(showcase, ))
    for dataset in datasets:
        ResourceFactory.create_batch(3, dataset=dataset)
    return showcase
示例#4
0
def active_editor():
    usr = EditorFactory.create(email='*****@*****.**',
                               password='******',
                               phone='0048123456789')
    org = OrganizationFactory.create(users=(usr, ))
    ds = DatasetFactory.create(organization=org)
    ResourceFactory.create_batch(2, dataset=ds)
    return usr
示例#5
0
def application_with_id_and_datasets(application_id, num):
    application = ApplicationFactory.create(
        id=application_id,
        title='application {} with datasets'.format(application_id))
    datasets = DatasetFactory.create_batch(num, applications=(application, ))
    for dataset in datasets:
        ResourceFactory.create_batch(3, dataset=dataset)
    return application
示例#6
0
def three_datasets_with_different_created_at(dates):
    dates_ = dates.split("|")
    datasets = []
    for d in dates_:
        d = parser.parse(d)
        ds = DatasetFactory.create(created=d)
        datasets.append(ds)
    return datasets
示例#7
0
def dataset_with_resource_and_params(field_name, field_value):
    _dataset = DatasetFactory.create()
    kwargs = {
        field_name: field_value
    }
    ResourceFactory.create(dataset=_dataset, **kwargs)
    CategoryFactory.create_batch(2, datasets=(_dataset,))
    return _dataset
示例#8
0
def dataset_with_chart_as_visualization_type():
    _dataset = DatasetFactory.create()
    _resource = ResourceFactory(
        dataset=_dataset,
        link='https://github.com/frictionlessdata/goodtables-py/blob/master/data/valid.csv',
    )
    ChartFactory.create(resource=_resource, is_default=True)
    _dataset.save()
    return _dataset
示例#9
0
def dataset_with_id_and_resources(dataset_id, slug):
    _dataset = DatasetFactory.create(id=dataset_id, slug=slug)
    ResourceFactory.create_batch(2, dataset=_dataset)
    return _dataset
示例#10
0
def second_dataset_with_id(dataset_id):
    _dataset = DatasetFactory.create(id=dataset_id, title='Second dataset %s' % dataset_id)
    return _dataset
示例#11
0
def removed_dataset():
    _dataset = DatasetFactory.create(is_removed=True, title='Removed dataset')
    return _dataset
示例#12
0
def dataset():
    _dataset = DatasetFactory.create()
    TagFactory.create_batch(2, datasets=(_dataset,))
    return _dataset
示例#13
0
def dataset_with_resource():
    _dataset = DatasetFactory.create()
    ResourceFactory.create(dataset=_dataset)
    CategoryFactory.create_batch(2, datasets=(_dataset,))
    return _dataset
示例#14
0
def application_with_datasets():
    org = ApplicationFactory.create()
    DatasetFactory.create_batch(2, application=org)
    return org
示例#15
0
def article_with_datasets():
    _article = ArticleFactory.create(title='Article with datasets')
    DatasetFactory.create_batch(2, articles=(_article, ))
    return _article
示例#16
0
def number_of_datasets_with_resources_with_type(number_of_datasets, num, res_type):
    for x in range(number_of_datasets):
        _dataset = DatasetFactory.create()
        ResourceFactory.create_batch(num, dataset=_dataset, type=res_type)
示例#17
0
def dataset_with_title_and_x_resources(title, num):
    _dataset = DatasetFactory.create(title=title)
    ResourceFactory.create_batch(num, dataset=_dataset)
    return _dataset
示例#18
0
def dataset_with_id_and_showcases(dataset_id, num):
    _dataset = DatasetFactory.create(id=dataset_id, title='dataset {} with showcases'.format(dataset_id))
    for x in range(num):
        ShowcaseFactory.create(title=f'Ponowne wykorzystanie {x+1}', datasets=[_dataset])
    return _dataset
示例#19
0
def dataset_with_id_and_datasets(dataset_id, num):
    _dataset = DatasetFactory.create(id=dataset_id, title='dataset {} with resources'.format(dataset_id))
    ResourceFactory.create_batch(num, dataset=_dataset)
    return _dataset
示例#20
0
def dataset_with_id(dataset_id):
    _dataset = DatasetFactory.create(
        id=dataset_id,
        title=f'test dataset with id {dataset_id}',
    )
    return _dataset
示例#21
0
def another_dataset_with_id(dataset_id):
    _dataset = DatasetFactory.create(id=dataset_id, title='Another dataset %s' % dataset_id)
    return _dataset
示例#22
0
def add_dataset_to_article(dataset_id, article_id):
    instance = ArticleFactory._meta.model.objects.get(pk=article_id)
    dataset_instance = DatasetFactory(pk=dataset_id)
    instance.datasets.add(dataset_instance)
示例#23
0
def dataset_with_resources():
    _dataset = DatasetFactory.create()
    ResourceFactory.create_batch(2, dataset=_dataset)
    return _dataset
示例#24
0
def showcase_with_datasets():
    showcase = ShowcaseFactory.create()
    DatasetFactory.create_batch(2, showcase=showcase)
    return showcase
示例#25
0
def imported_ckan_resource():
    _source = DataSourceFactory.create(source_type='CKAN', name='Test name', portal_url='http://example.com')
    _dataset = DatasetFactory.create(source=_source)
    _resource = ResourceFactory.create(dataset=_dataset)
    return _resource
示例#26
0
def imported_dataset(dataset_data, source_type, name, portal_url):
    dataset_data = json.loads(dataset_data)
    _source = DataSourceFactory.create(source_type=source_type, name=name, portal_url=portal_url)
    _dataset = DatasetFactory.create(source=_source, **dataset_data)
    ResourceFactory.create(dataset=_dataset)
    return _dataset
示例#27
0
def x_datasets(num):
    return DatasetFactory.create_batch(num)
示例#28
0
def imported_resource_of_type(resource_id, source_type, name, portal_url, res_type):
    _source = DataSourceFactory.create(source_type=source_type, name=name, portal_url=portal_url)
    _dataset = DatasetFactory.create(source=_source)
    _resource = ResourceFactory.create(id=resource_id, dataset=_dataset, type=res_type)
    return _resource
示例#29
0
def datasets():
    return DatasetFactory.create_batch(3)
示例#30
0
def article_with_id_with_datasets(article_id, num):
    _article = ArticleFactory.create(
        id=article_id, title='Article {} with datasets'.format(article_id))
    DatasetFactory.create_batch(num, articles=(_article, ))
    return _article