Skip to content

Commit

Permalink
Merge pull request #204 from ckan/github-176-download-proxy
Browse files Browse the repository at this point in the history
Document the ckan.download_proxy setting, #176
  • Loading branch information
ThrawnCA authored Jan 29, 2024
2 parents 1ee470a + 994279a commit 925fe53
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ Configuration:

See the extension's `config_declaration.yaml <ckanext/xloader/config_declaration.yaml>`_ file.

This plugin also supports the `ckan.download_proxy` setting, to use a proxy server when downloading files.
This setting is shared with other plugins that download resource files, such as ckanext-archiver. Eg:

ckan.download_proxy = http://my-proxy:1234/

------------------------
Developer installation
Expand Down
24 changes: 12 additions & 12 deletions ckanext/xloader/tests/test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,39 +622,39 @@ def test_german(self, Session):

def test_with_blanks(self, Session):
csv_filepath = get_sample_filepath("sample_with_blanks.csv")
resource_id = "test1"
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,
)
assert len(self._get_records(Session, "test1")) == 3
assert len(self._get_records(Session, resource_id)) == 3

def test_with_mixed_quotes(self, Session):
csv_filepath = get_sample_filepath("sample_with_mixed_quotes.csv")
resource_id = "test1"
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,
)
assert len(self._get_records(Session, "test1")) == 2
assert len(self._get_records(Session, resource_id)) == 2

def test_with_mixed_types(self, Session):
csv_filepath = get_sample_filepath("mixed_numeric_string_sample.csv")
resource_id = "test1"
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,
)
assert len(self._get_records(Session, "test1")) == 2
assert len(self._get_records(Session, resource_id)) == 2

def test_reload(self, Session):
csv_filepath = get_sample_filepath("simple.csv")
Expand Down Expand Up @@ -1182,12 +1182,12 @@ def test_no_entries(self):

def test_with_mixed_quotes(self, Session):
csv_filepath = get_sample_filepath("sample_with_mixed_quotes.csv")
resource_id = "test1"
factories.Resource(id=resource_id)
resource = factories.Resource()
resource_id = resource['id']
loader.load_table(
csv_filepath,
resource_id=resource_id,
mimetype="text/csv",
logger=logger,
)
assert len(self._get_records(Session, "test1")) == 2
assert len(self._get_records(Session, resource_id)) == 2

0 comments on commit 925fe53

Please sign in to comment.