Configure default CKAN settings

Share:

Description

Configure default CKAN settings

Usage

1
2
3
ckanr_setup(url = "http://data.techno-science.ca/", key = NULL,
  test_url = NULL, test_key = NULL, test_did = NULL, test_rid = NULL,
  test_gid = NULL, test_oid = NULL, test_behaviour = NULL)

Arguments

url

A CKAN URL (optional), default: "http://data.techno-science.ca/"

key

A CKAN API key (optional, character)

test_url

(optional, character) A valid CKAN URL for testing purposes

test_key

(optional, character) A valid CKAN API key privileged to create datasets at test_url

test_did

(optional, character) A valid CKAN dataset ID, existing at test_url

test_rid

(optional, character) A valid CKAN resource ID, attached to did

test_gid

(optional, character) A valid CKAN group name at test_url

test_oid

(optional, character) A valid CKAN organization name at test_url

test_behaviour

(optional, character) Whether to fail ("FAIL") or skip ("SKIP") writing tests in case of problems with the configured test CKAN.

Details

ckanr_setup sets CKAN connection details. ckanr's functions default to use the default URL and API key unless specified explicitly.

ckanr's automated tests require a valid CKAN URL, a privileged API key for that URL, plus the IDs of an existing dataset and an existing resource, repectively.

The writing tests (create, update, delete) can fail for two reasons: failures in ckanr's code which the tests aim to detect, or failures in the configured CKAN, which are not necessarily a problem with ckanr's code but prevent the tests to prove otherwise.

Setting test_behaviour to "SKIP" will allow writing tests to skip if the configured test CKAN fails. This is desirable to e.g. test the other functions even if the tester has no write access to a CKAN instance.

Setting test_behaviour to "FAIL" will let the tester find any problems with both the configured test CKAN and the writing functions.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# CKAN users without admin/editor privileges could run:
ckanr_setup(url = "http://data.techno-science.ca/")

# Privileged CKAN editor/admin users can run:
ckanr_setup(url = "http://data.techno-science.ca/", key = "some-CKAN-API-key")

# ckanR developers/testers can run:
ckanr_setup(url = "http://data.techno-science.ca/", key = "some-CKAN-API-key",
           test_url = "http://test-ckan.gov/",test_key = "test-ckan-API-key",
           test_did = "test-ckan-dataset-id",test_rid = "test-ckan-resource-id",
           test_gid = "test-group-name", test_oid = "test-organzation-name",
           test_behaviour = "FAIL")

# Not specifying the default CKAN URL will reset the CKAN URL to its default
# "http://data.techno-science.ca/":
ckanr_setup()

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.