Commit 1f347c1b authored by David Read's avatar David Read
Browse files

Fix tests

parent d419e727
......@@ -439,8 +439,8 @@ def archive_resource(context, resource, log, result=None, url_timeout=30):
# calculate the cache_url
if not context.get('cache_url_root'):
log.warning('Not saved cache_url because no value for cache_url_root '
'in config')
log.warning('Not saved cache_url because no value for '
'ckanext-archiver.cache_url_root in config')
raise ArchiveError('No value for ckanext-archiver.cache_url_root in config')
cache_url = urlparse.urljoin(context['cache_url_root'],
'%s/%s' % (relative_archive_path, file_name))
......
......@@ -22,7 +22,7 @@ CELERY_ALWAYS_EAGER = True
use = config:../ckan/test-core.ini
ckan.plugins = archiver testipipe
ckan.cache_url_root = http://localhost:50001/resources/
ckanext-archiver.cache_url_root = http://localhost:50001/resources/
ckanext-archiver.max_content_length = 1000000
# Logging configuration
......
......@@ -14,6 +14,12 @@ from ckan import model
from ckan import plugins
from ckan.tests import BaseCase
from ckan.logic import get_action
try:
from ckan.tests.helpers import reset_db
from ckan.tests import factories as ckan_factories
except ImportError:
from ckan.new_tests.helpers import reset_db
from ckan.new_tests import factories as ckan_factories
from ckanext.archiver import model as archiver_model
from ckanext.archiver.model import Archival
......@@ -62,6 +68,7 @@ class TestLinkChecker(BaseCase):
@classmethod
def setup_class(cls):
reset_db()
plugins.unload_all()
cls._saved_plugins_config = config.get('ckan.plugins', '')
config['ckan.plugins'] = 'archiver'
......@@ -158,6 +165,7 @@ class TestArchiver(BaseCase):
@classmethod
def setup_class(cls):
reset_db()
archiver_model.init_tables(model.meta.engine)
cls.temp_dir = tempfile.mkdtemp()
......@@ -176,11 +184,10 @@ class TestArchiver(BaseCase):
model.repo.commit_and_remove()
def _test_package(self, url, format=None):
context = {'model': model, 'ignore_auth': True, 'session': model.Session, 'user': 'test'}
pkg = {'name': 'testpkg', 'resources': [
pkg = {'resources': [
{'url': url, 'format': format or 'TXT', 'description': 'Test'}
]}
pkg = get_action('package_create')(context, pkg)
pkg = ckan_factories.Dataset(**pkg)
return pkg
def _test_resource(self, url, format=None):
......@@ -375,6 +382,7 @@ class TestDownload(BaseCase):
'''
@classmethod
def setup_class(cls):
reset_db()
config
cls.fake_context = {
'site_url': config.get('ckan.site_url_internally') or config['ckan.site_url'],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment