def setup_class(cls): # Initialize the test db (if it isn't already) and clean out any data # left in it. # You should only do this in your setup_class() method if your test # class uses the db, most test classes shouldn't need to. helpers.reset_db()
def teardown_class(cls): plugins.unload('example_idatasetform_v4') helpers.reset_db() ckan.lib.search.clear() config.clear() config.update(cls.original_config)
def setup(self): helpers.reset_db() # Create test user self.normal_user = helpers.call_action('user_create', name='normal_user', email='*****@*****.**', password='******')
def setup_class(cls): super(cls, cls).setup_class() if not p.plugin_loaded('image_view'): p.load('image_view') helpers.reset_db()
def setup(self): helpers.reset_db() self.ec_dict = { "UserName": "******", "About": "", "DisplayName": "", "Roles": [ "OrganisationEditor" ], "FirstName": "", "LastName": "", "UserId": "e350cb61-ed72-4335-b915-7617b5e931f0", "IsRegistered": False, "OrganisationId": "2", "Email": "" } self.org_dict = {"MetadataResultSet": [ { "Id": u'2', "Title": u"Microsoft", "CreatedTime": u"2014-05-21T00:00:00", "ModifiedTime": u"2014-05-21T00:00:00" } ] }
def setup_class(cls): if not p.plugin_loaded('image_view'): p.load('image_view') if not p.plugin_loaded('webpage_view'): p.load('webpage_view') helpers.reset_db()
def teardown_class(cls): helpers.reset_db() model.repo.rebuild_db() ckan.lib.search.clear() config.clear() config.update(cls.original_config)
def destroy(self): ''' Resets the database and any class variables that have been altered, e.g. title string. ''' helpers.reset_db() self.author = 'Test Author' self.title = 'A test package'
def setup_class(cls): cls.original_config = config.copy() cls._load_plugins() cls.app = _get_test_app() search.clear() helpers.reset_db() cls._create_test_data()
def setup_class(cls): if not is_datastore_supported(): raise nose.SkipTest('Datastore not supported') if not p.plugin_loaded('datastore'): p.load('datastore') if not p.plugin_loaded('datapusher'): p.load('datapusher') if not p.plugin_loaded('recline_grid_view'): p.load('recline_grid_view') helpers.reset_db()
def setup(self): helpers.reset_db() self.normal_user = helpers.call_action('user_create', name='normal_user', email='*****@*****.**', password='******') # Create test org self.test_org = helpers.call_action('organization_create', context={ 'user': '******', 'local_action': True, }, name='test_org', id='organisation123')
def setup(self): helpers.reset_db() self.normal_user = helpers.call_action('user_create', name='normal_user', email='*****@*****.**', password='******') self.test_user = helpers.call_action('user_create', id='userid123', name='testuser', email='*****@*****.**', password='******') # Create test org that the user is currently in self.test_org = helpers.call_action('organization_create', context={ 'user': '******', 'local_action': True, }, name='an_org')
def setup(self): helpers.reset_db() self.normal_user = helpers.call_action('user_create', name='normal_user', email='*****@*****.**', password='******') self.test_user = helpers.call_action('user_create', id='userid123', name='testuser', email='*****@*****.**', password='******') # Create test org that the user is currently in self.test_org = helpers.call_action('organization_create', context={ 'user': '******', 'local_action': True, }, name='an_org') helpers.call_action('organization_member_create', context={ 'user': '******', 'local_action': True, }, id=self.test_org['id'], username=self.test_user['name'], role='editor') # the org we want to add the user to self.test_org = helpers.call_action('organization_create', context={ 'user': '******', 'local_action': True, }, name='test_org', id='organisation123')
def teardown(self): helpers.reset_db() search.clear()
def teardown(cls): h.reset_db()
def teardown(self): helpers.reset_db()
def setup_class(cls): helpers.reset_db() PylonsTestCase.setup_class() DguCreateTestData.create_dgu_test_data()
def setup(self): helpers.reset_db()
def teardown_class(cls): p.unload('image_view') helpers.reset_db()
def setup(cls): helpers.reset_db()
def setup_class(cls): h.reset_db() cls.gather_consumer = queue.get_gather_consumer() cls.fetch_consumer = queue.get_fetch_consumer() # Minimal remote RDF file cls.rdf_mock_url = 'http://some.dcat.file.rdf' cls.rdf_content_type = 'application/rdf+xml' cls.rdf_content = '''<?xml version="1.0" encoding="utf-8" ?> <rdf:RDF xmlns:dct="http://purl.org/dc/terms/" xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <dcat:Catalog rdf:about="https://data.some.org/catalog"> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/1"> <dct:title>Example dataset 1</dct:title> </dcat:Dataset> </dcat:dataset> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/2"> <dct:title>Example dataset 2</dct:title> </dcat:Dataset> </dcat:dataset> </dcat:Catalog> </rdf:RDF> ''' # Minimal remote RDF file with pagination (1) # Use slashes for paginated URLs because HTTPretty won't distinguish # query strings cls.rdf_mock_url_pagination_1 = 'http://some.dcat.file.pagination.rdf' cls.rdf_content_pagination_1 = '''<?xml version="1.0" encoding="utf-8" ?> <rdf:RDF xmlns:dct="http://purl.org/dc/terms/" xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:hydra="http://www.w3.org/ns/hydra/core#"> <dcat:Catalog rdf:about="https://data.some.org/catalog"> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/1"> <dct:title>Example dataset 1</dct:title> </dcat:Dataset> </dcat:dataset> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/2"> <dct:title>Example dataset 2</dct:title> </dcat:Dataset> </dcat:dataset> </dcat:Catalog> <hydra:PagedCollection rdf:about="http://some.dcat.file.pagination.rdf/page/1"> <hydra:totalItems rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">4</hydra:totalItems> <hydra:lastPage>http://some.dcat.file.pagination.rdf/page/2</hydra:lastPage> <hydra:itemsPerPage rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">2</hydra:itemsPerPage> <hydra:nextPage>http://some.dcat.file.pagination.rdf/page/2</hydra:nextPage> <hydra:firstPage>http://some.dcat.file.pagination.rdf/page/1</hydra:firstPage> </hydra:PagedCollection> </rdf:RDF> ''' # Minimal remote RDF file with pagination (2) cls.rdf_mock_url_pagination_2 = 'http://some.dcat.file.pagination.rdf/page/2' cls.rdf_content_pagination_2 = '''<?xml version="1.0" encoding="utf-8" ?> <rdf:RDF xmlns:dct="http://purl.org/dc/terms/" xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:hydra="http://www.w3.org/ns/hydra/core#"> <dcat:Catalog rdf:about="https://data.some.org/catalog"> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/3"> <dct:title>Example dataset 3</dct:title> </dcat:Dataset> </dcat:dataset> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/4"> <dct:title>Example dataset 4</dct:title> </dcat:Dataset> </dcat:dataset> </dcat:Catalog> <hydra:PagedCollection rdf:about="http://some.dcat.file.pagination.rdf/page/1"> <hydra:totalItems rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">4</hydra:totalItems> <hydra:lastPage>http://some.dcat.file.pagination.rdf/page/2</hydra:lastPage> <hydra:itemsPerPage rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">2</hydra:itemsPerPage> <hydra:previousPage>http://some.dcat.file.pagination.rdf/page/1</hydra:previousPage> <hydra:firstPage>http://some.dcat.file.pagination.rdf/page/1</hydra:firstPage> </hydra:PagedCollection> </rdf:RDF> ''' # Minimal remote RDF file cls.rdf_mock_url = 'http://some.dcat.file.rdf' cls.rdf_content_type = 'application/rdf+xml' cls.rdf_content = '''<?xml version="1.0" encoding="utf-8" ?> <rdf:RDF xmlns:dct="http://purl.org/dc/terms/" xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <dcat:Catalog rdf:about="https://data.some.org/catalog"> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/1"> <dct:title>Example dataset 1</dct:title> </dcat:Dataset> </dcat:dataset> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/2"> <dct:title>Example dataset 2</dct:title> </dcat:Dataset> </dcat:dataset> </dcat:Catalog> </rdf:RDF> ''' cls.rdf_remote_file_small = '''<?xml version="1.0" encoding="utf-8" ?> <rdf:RDF xmlns:dct="http://purl.org/dc/terms/" xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <dcat:Catalog rdf:about="https://data.some.org/catalog"> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/1"> <dct:title>Example dataset 1</dct:title> </dcat:Dataset> </dcat:dataset> </dcat:Catalog> </rdf:RDF> ''' # RDF with minimal distribution cls.rdf_content_with_distribution_uri = '''<?xml version="1.0" encoding="utf-8" ?> <rdf:RDF xmlns:dct="http://purl.org/dc/terms/" xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <dcat:Catalog rdf:about="https://data.some.org/catalog"> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/1"> <dct:title>Example dataset 1</dct:title> <dcat:distribution> <dcat:Distribution rdf:about="https://data.some.org/catalog/datasets/1/resource/1"> <dct:title>Example resource 1</dct:title> <dcat:accessURL>http://data.some.org/download.zip</dcat:accessURL> </dcat:Distribution> </dcat:distribution> </dcat:Dataset> </dcat:dataset> </dcat:Catalog> </rdf:RDF> ''' cls.rdf_content_with_distribution = '''<?xml version="1.0" encoding="utf-8" ?> <rdf:RDF xmlns:dct="http://purl.org/dc/terms/" xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <dcat:Catalog rdf:about="https://data.some.org/catalog"> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/1"> <dct:title>Example dataset 1</dct:title> <dcat:distribution> <dcat:Distribution> <dct:title>Example resource 1</dct:title> <dcat:accessURL>http://data.some.org/download.zip</dcat:accessURL> </dcat:Distribution> </dcat:distribution> </dcat:Dataset> </dcat:dataset> </dcat:Catalog> </rdf:RDF> ''' cls.rdf_remote_file_invalid = '''<?xml version="1.0" encoding="utf-8" ?> <rdf:RDF xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <dcat:Catalog </rdf:RDF> ''' #Minimal remote turtle file cls.ttl_mock_url = 'http://some.dcat.file.ttl' cls.ttl_content_type = 'text/turtle' cls.ttl_content = '''@prefix dcat: <http://www.w3.org/ns/dcat#> . @prefix dc: <http://purl.org/dc/terms/> . <https://data.some.org/catalog> a dcat:Catalog ; dcat:dataset <https://data.some.org/catalog/datasets/1>, <https://data.some.org/catalog/datasets/2> . <https://data.some.org/catalog/datasets/1> a dcat:Dataset ; dc:title "Example dataset 1" . <https://data.some.org/catalog/datasets/2> a dcat:Dataset ; dc:title "Example dataset 2" . ''' cls.ttl_remote_file_small = '''@prefix dcat: <http://www.w3.org/ns/dcat#> . @prefix dc: <http://purl.org/dc/terms/> . <https://data.some.org/catalog> a dcat:Catalog ; dcat:dataset <https://data.some.org/catalog/datasets/1>, <https://data.some.org/catalog/datasets/2> . <https://data.some.org/catalog/datasets/1> a dcat:Dataset ; dc:title "Example dataset 1" . ''' cls.ttl_unicode_in_keywords = u'''@prefix dcat: <http://www.w3.org/ns/dcat#> . @prefix dc: <http://purl.org/dc/terms/> . <https://data.some.org/catalog> a dcat:Catalog ; dcat:dataset <https://data.some.org/catalog/datasets/1> . <https://data.some.org/catalog/datasets/1> a dcat:Dataset ; dc:title "Example dataset 1" ; dcat:keyword "förskola", "Garduña" . <https://data.some.org/catalog/datasets/2> a dcat:Dataset ; dc:title "Example dataset 2" ; dcat:keyword "San Sebastián", "Ελλάδα" . ''' cls.ttl_commas_in_keywords = u'''@prefix dcat: <http://www.w3.org/ns/dcat#> . @prefix dc: <http://purl.org/dc/terms/> . <https://data.some.org/catalog> a dcat:Catalog ; dcat:dataset <https://data.some.org/catalog/datasets/1> . <https://data.some.org/catalog/datasets/1> a dcat:Dataset ; dc:title "Example dataset 1" ; dcat:keyword "Utbildning, kontaktuppgifter" . <https://data.some.org/catalog/datasets/2> a dcat:Dataset ; dc:title "Example dataset 2" ; dcat:keyword "Trees, forest, shrub" . ''' cls.ttl_remote_file_invalid = '''@prefix dcat: <http://www.w3.org/ns/dcat#> .
def setup(self): results.create_database_table() helpers.reset_db()
def teardown_class(self): helpers.reset_db()
def teardown_class(cls): p.unload('image_view') super(TestImageView, cls).teardown_class() helpers.reset_db()
def setup_class(cls): helpers.reset_db()
def teardown_class(cls): helpers.reset_db() search.clear()
def setup(self): helpers.reset_db() search.clear()
def test_convert_ckan_resource_to_ec_file_no_ec_api_dataset_id(self): # Create a dataset for the resource helpers.call_action('user_create', name='sysadmin_user', email='*****@*****.**', password='******', sysadmin=True) helpers.call_action('organization_create', context={ 'user': '******', 'local_action': True, }, name='test_org', extras=[{'key': 'ec_api_id', 'value': 1}]) context = {'local_action': True, 'user': '******'} data_dict = { 'name': 'test_dataset', 'owner_org': 'test_org', 'title': 'Test Dataset', 'notes': 'Some longer description', 'needs_approval': False, 'maintainer': 'Test maintainer', 'maintainer_email': 'Test maintainer email', 'license_id': 'OGL-UK-2.0', 'openness_rating': 3, 'quality': 5, 'id': 4, } test_org = helpers.call_action('package_create', context=context, **data_dict) ckan_dict = { 'package_id': 'test-dataset', 'name': 'Test File name', 'url': 'http://some.file.com', 'description': 'Some longer description', 'format': 'application/csv', 'license_id': 'uk-ogl', 'openness_rating': 3, 'quality': 5, 'standard_name': 'Test standard name', 'standard_rating': 1, 'standard_version': 'Test standard version', 'creation_date': '2014-03-22T05:42:00', 'id': 'resource-id', } ec_dict = custom_schema.convert_ckan_resource_to_ec_file(ckan_dict) eq_(ec_dict['FileId'], 'resource-id') eq_(ec_dict['DatasetId'], 'test-dataset') eq_(ec_dict['Title'], 'Test File name') eq_(ec_dict['ExternalUrl'], 'http://some.file.com') eq_(ec_dict['Description'], 'Some longer description') eq_(ec_dict['Type'], 'application/csv') eq_(ec_dict['License'], 'uk-ogl') eq_(ec_dict['OpennessRating'], 3) eq_(ec_dict['Quality'], 5) eq_(ec_dict['StandardName'], 'Test standard name') eq_(ec_dict['StandardRating'], 1) eq_(ec_dict['StandardVersion'], 'Test standard version') eq_(ec_dict['CreationDate'], '2014-03-22T05:42:00') helpers.reset_db()
def teardown_class(cls): p.unload('datastore') helpers.reset_db()
def setup(self): helpers.reset_db() # Clear the search index search.clear()
def teardown_class(cls): cls.config.reset() ckan.plugins.unload('twitter') helpers.reset_db()
def teardown_class(cls): p.unload('webpage_view') super(TestWebPageView, cls).teardown_class() helpers.reset_db()
def teardown_class(cls): helpers.reset_db()
def setup_class(cls): super(cls, cls).setup_class() helpers.reset_db()
def setup_class(cls): h.reset_db() cls.gather_consumer = queue.get_gather_consumer() cls.fetch_consumer = queue.get_fetch_consumer() # Minimal remote RDF file cls.rdf_mock_url = 'http://some.dcat.file.rdf' cls.rdf_content_type = 'application/rdf+xml' cls.rdf_content = '''<?xml version="1.0" encoding="utf-8" ?> <rdf:RDF xmlns:dct="http://purl.org/dc/terms/" xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <dcat:Catalog rdf:about="https://data.some.org/catalog"> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/1"> <dct:title>Example dataset 1</dct:title> </dcat:Dataset> </dcat:dataset> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/2"> <dct:title>Example dataset 2</dct:title> </dcat:Dataset> </dcat:dataset> </dcat:Catalog> </rdf:RDF> ''' # Minimal remote RDF file with pagination (1) # Use slashes for paginated URLs because HTTPretty won't distinguish # query strings cls.rdf_mock_url_pagination_1 = 'http://some.dcat.file.pagination.rdf' cls.rdf_content_pagination_1 = '''<?xml version="1.0" encoding="utf-8" ?> <rdf:RDF xmlns:dct="http://purl.org/dc/terms/" xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:hydra="http://www.w3.org/ns/hydra/core#"> <dcat:Catalog rdf:about="https://data.some.org/catalog"> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/1"> <dct:title>Example dataset 1</dct:title> </dcat:Dataset> </dcat:dataset> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/2"> <dct:title>Example dataset 2</dct:title> </dcat:Dataset> </dcat:dataset> </dcat:Catalog> <hydra:PagedCollection rdf:about="http://some.dcat.file.pagination.rdf/page/1"> <hydra:totalItems rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">4</hydra:totalItems> <hydra:lastPage>http://some.dcat.file.pagination.rdf/page/2</hydra:lastPage> <hydra:itemsPerPage rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">2</hydra:itemsPerPage> <hydra:nextPage>http://some.dcat.file.pagination.rdf/page/2</hydra:nextPage> <hydra:firstPage>http://some.dcat.file.pagination.rdf/page/1</hydra:firstPage> </hydra:PagedCollection> </rdf:RDF> ''' # Minimal remote RDF file with pagination (2) cls.rdf_mock_url_pagination_2 = 'http://some.dcat.file.pagination.rdf/page/2' cls.rdf_content_pagination_2 = '''<?xml version="1.0" encoding="utf-8" ?> <rdf:RDF xmlns:dct="http://purl.org/dc/terms/" xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:hydra="http://www.w3.org/ns/hydra/core#"> <dcat:Catalog rdf:about="https://data.some.org/catalog"> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/3"> <dct:title>Example dataset 3</dct:title> </dcat:Dataset> </dcat:dataset> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/4"> <dct:title>Example dataset 4</dct:title> </dcat:Dataset> </dcat:dataset> </dcat:Catalog> <hydra:PagedCollection rdf:about="http://some.dcat.file.pagination.rdf/page/1"> <hydra:totalItems rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">4</hydra:totalItems> <hydra:lastPage>http://some.dcat.file.pagination.rdf/page/2</hydra:lastPage> <hydra:itemsPerPage rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">2</hydra:itemsPerPage> <hydra:previousPage>http://some.dcat.file.pagination.rdf/page/1</hydra:previousPage> <hydra:firstPage>http://some.dcat.file.pagination.rdf/page/1</hydra:firstPage> </hydra:PagedCollection> </rdf:RDF> ''' # Minimal remote RDF file cls.rdf_mock_url = 'http://some.dcat.file.rdf' cls.rdf_content_type = 'application/rdf+xml' cls.rdf_content = '''<?xml version="1.0" encoding="utf-8" ?> <rdf:RDF xmlns:dct="http://purl.org/dc/terms/" xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <dcat:Catalog rdf:about="https://data.some.org/catalog"> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/1"> <dct:title>Example dataset 1</dct:title> </dcat:Dataset> </dcat:dataset> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/2"> <dct:title>Example dataset 2</dct:title> </dcat:Dataset> </dcat:dataset> </dcat:Catalog> </rdf:RDF> ''' cls.rdf_remote_file_small = '''<?xml version="1.0" encoding="utf-8" ?> <rdf:RDF xmlns:dct="http://purl.org/dc/terms/" xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <dcat:Catalog rdf:about="https://data.some.org/catalog"> <dcat:dataset> <dcat:Dataset rdf:about="https://data.some.org/catalog/datasets/1"> <dct:title>Example dataset 1</dct:title> </dcat:Dataset> </dcat:dataset> </dcat:Catalog> </rdf:RDF> ''' cls.rdf_remote_file_invalid = '''<?xml version="1.0" encoding="utf-8" ?> <rdf:RDF xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <dcat:Catalog </rdf:RDF> ''' #Minimal remote turtle file cls.ttl_mock_url = 'http://some.dcat.file.ttl' cls.ttl_content_type = 'text/turtle' cls.ttl_content = '''@prefix dcat: <http://www.w3.org/ns/dcat#> . @prefix dc: <http://purl.org/dc/terms/> . <https://data.some.org/catalog> a dcat:Catalog ; dcat:dataset <https://data.some.org/catalog/datasets/1>, <https://data.some.org/catalog/datasets/2> . <https://data.some.org/catalog/datasets/1> a dcat:Dataset ; dc:title "Example dataset 1" . <https://data.some.org/catalog/datasets/2> a dcat:Dataset ; dc:title "Example dataset 2" . ''' cls.ttl_remote_file_small = '''@prefix dcat: <http://www.w3.org/ns/dcat#> . @prefix dc: <http://purl.org/dc/terms/> . <https://data.some.org/catalog> a dcat:Catalog ; dcat:dataset <https://data.some.org/catalog/datasets/1>, <https://data.some.org/catalog/datasets/2> . <https://data.some.org/catalog/datasets/1> a dcat:Dataset ; dc:title "Example dataset 1" . ''' cls.ttl_unicode_in_keywords = u'''@prefix dcat: <http://www.w3.org/ns/dcat#> . @prefix dc: <http://purl.org/dc/terms/> . <https://data.some.org/catalog> a dcat:Catalog ; dcat:dataset <https://data.some.org/catalog/datasets/1> . <https://data.some.org/catalog/datasets/1> a dcat:Dataset ; dc:title "Example dataset 1" ; dcat:keyword "förskola", "Garduña" . <https://data.some.org/catalog/datasets/2> a dcat:Dataset ; dc:title "Example dataset 2" ; dcat:keyword "San Sebastián", "Ελλάδα" . ''' cls.ttl_commas_in_keywords = u'''@prefix dcat: <http://www.w3.org/ns/dcat#> . @prefix dc: <http://purl.org/dc/terms/> . <https://data.some.org/catalog> a dcat:Catalog ; dcat:dataset <https://data.some.org/catalog/datasets/1> . <https://data.some.org/catalog/datasets/1> a dcat:Dataset ; dc:title "Example dataset 1" ; dcat:keyword "Utbildning, kontaktuppgifter" . <https://data.some.org/catalog/datasets/2> a dcat:Dataset ; dc:title "Example dataset 2" ; dcat:keyword "Trees, forest, shrub" . ''' cls.ttl_remote_file_invalid = '''@prefix dcat: <http://www.w3.org/ns/dcat#> .
def setup(self): # Delete any stuff that's been created in the db, so it doesn't # interfere with the next test. helpers.reset_db() # create a test dataset so that database is not empty factories.Dataset(name='test-dataset')