# Path: ckan_api_client/tests/functional/ckan_api/utils.py
# class CkanClient(object):
#     """Simple client for the Ckan API"""
# 
#     def __init__(self, url, api_key=None):
#         self.url = url
#         self.api_key = api_key
# 
#     def request(self, method, path, **kw):
#         kw = copy.deepcopy(kw)
#         if 'headers' not in kw:
#             kw['headers'] = CaseInsensitiveDict()
#         elif not isinstance(kw['headers'], CaseInsensitiveDict):
#             kw['headers'] = CaseInsensitiveDict(kw['headers'])
#         if 'data' in kw:
#             kw['data'] = json.dumps(kw['data'])
#             kw['headers']['Content-type'] = 'application/json'
#         if self.api_key is not None:
#             kw['headers']['Authorization'] = self.api_key
#         url = urlparse.urljoin(self.url, path)
#         return requests.request(method, url, **kw)
# 
#     def get(self, *a, **kw):
#         return self.request('get', *a, **kw)
# 
#     def post(self, *a, **kw):
#         return self.request('post', *a, **kw)


import cgi
import pytest
from .utils import CkanClient





DUMMY_PACKAGES = {}
DUMMY_PACKAGES['simplest_package'] = {
    'name': 'hello-dataset',
    'title': 'Hello, dataset!',
}
DUMMY_PACKAGES['package_with_metadata'] = {
    'name': 'package-with-metadata',
    'title': 'Package with metadata',
    'author': 'Author Name',
    'author_email': 'author.name@example.com',
    'maintainer': 'Maintainer Name',
    'maintainer_email': 'maintainer.name@example.com',
    'license_id': 'cc-by',
    'notes': 'Just a bunch of notes',
    'url': 'http://example.com/dataset/package-with-metadata',
    'state': 'active',
    # 'type': 'dataset',

    # 'resources': [],
    # 'tags': [],
    # 'extras': [{'key': 'Fuck', 'value': 'This!'}],
    # 'groups': [],
    # 'owner_org': ['dummy-org'],
}
DUMMY_PACKAGES['package_with_extras'] = {

# Path: ckan_api_client/tests/functional/ckan_api/utils.py
# class CkanClient(object):
#     """Simple client for the Ckan API"""
# 
#     def __init__(self, url, api_key=None):
#         self.url = url
#         self.api_key = api_key
# 
#     def request(self, method, path, **kw):
#         kw = copy.deepcopy(kw)
#         if 'headers' not in kw:
#             kw['headers'] = CaseInsensitiveDict()
#         elif not isinstance(kw['headers'], CaseInsensitiveDict):
#             kw['headers'] = CaseInsensitiveDict(kw['headers'])
#         if 'data' in kw:
#             kw['data'] = json.dumps(kw['data'])
#             kw['headers']['Content-type'] = 'application/json'
#         if self.api_key is not None:
#             kw['headers']['Authorization'] = self.api_key
#         url = urlparse.urljoin(self.url, path)
#         return requests.request(method, url, **kw)
# 
#     def get(self, *a, **kw):
#         return self.request('get', *a, **kw)
# 
#     def post(self, *a, **kw):
#         return self.request('post', *a, **kw)


# Path: ckan_api_client/tests/functional/ckan_api/test_01_simple_crud.py
import cgi
import pytest
from .utils import CkanClient






DUMMY_PACKAGES = {}
DUMMY_PACKAGES['simplest_package'] = {
    'name': 'hello-dataset',
    'title': 'Hello, dataset!',
}
DUMMY_PACKAGES['package_with_metadata'] = {
    'name': 'package-with-metadata',
    'title': 'Package with metadata',
    'author': 'Author Name',
    'author_email': 'author.name@example.com',
    'maintainer': 'Maintainer Name',
    'maintainer_email': 'maintainer.name@example.com',
    'license_id': 'cc-by',
    'notes': 'Just a bunch of notes',
    'url': 'http://example.com/dataset/package-with-metadata',
    'state': 'active',
    # 'type': 'dataset',

    # 'resources': [],
    # 'tags': [],
    # 'extras': [{'key': 'Fuck', 'value': 'This!'}],
    # 'groups': [],
    # 'owner_org': ['dummy-org'],
}
DUMMY_PACKAGES['package_with_extras'] = {

    'name': 'package-with-extras',