Skip to content

Commit

Permalink
fix test resource IDs
Browse files Browse the repository at this point in the history
- Can't use an arbitrary string, validation requires a UUID
  • Loading branch information
ThrawnCA committed Oct 17, 2024
1 parent 82c014f commit fd9c758
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions ckanext/xloader/tests/test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,11 +819,11 @@ def test_column_names(self, Session):
@pytest.mark.ckan_config('ckanext.xloader.unicode_headers', 'True')
def test_unicode_column_names(self):
csv_filepath = get_sample_filepath('hebrew_sample.csv')
resource_id = 'test_hebrew'
factories.Resource(id=resource_id)
resource = factories.Resource()
resource_id = resource['id']
loader.load_csv(csv_filepath, resource_id=resource_id,
mimetype='text/csv', logger=logger)
records = self._get_records('test_hebrew')
records = self._get_records(resource_id)
print(records)
assert records[0] == (
1,
Expand All @@ -837,8 +837,8 @@ def test_unicode_column_names(self):
u'20/09/2018',
u'44.85', u'11.20'
)
print(self._get_column_names('test_hebrew'))
assert self._get_column_names('test_hebrew') == [
print(self._get_column_names(resource_id))
assert self._get_column_names(resource_id) == [
u'_id',
u'_full_text',
u'זיהוי',
Expand Down Expand Up @@ -1384,11 +1384,11 @@ def test_preserving_time_ranges(self, Session):
@pytest.mark.ckan_config('ckanext.xloader.unicode_headers', 'True')
def test_hebrew_unicode_headers(self):
xlsx_filepath = get_sample_filepath('hebrew_sample.xlsx')
resource_id = 'hebrew_sample_xlsx'
factories.Resource(id=resource_id)
resource = factories.Resource()
resource_id = resource['id']
loader.load_table(xlsx_filepath, resource_id=resource_id,
mimetype='xlsx', logger=logger)
records = self._get_records('hebrew_sample_xlsx')
records = self._get_records(resource_id)
print(records)
assert records[0] == (
1,
Expand All @@ -1403,8 +1403,8 @@ def test_hebrew_unicode_headers(self):
Decimal('44.85000000000000142108547152020037174224853515625'),
Decimal('11.199999999999999289457264239899814128875732421875')
)
print(self._get_column_names('hebrew_sample_xlsx'))
assert self._get_column_names('hebrew_sample_xlsx') == [
print(self._get_column_names(resource_id))
assert self._get_column_names(resource_id) == [
u'_id',
u'_full_text',
u'זיהוי',
Expand Down

0 comments on commit fd9c758

Please sign in to comment.