Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MJU-POPS
ckanext-archiver
Commits
df343c60
Commit
df343c60
authored
Nov 20, 2015
by
David Read
Browse files
Merge commit '
1f347c1b
' into fix-travis
parents
99de5995
1f347c1b
Changes
2
Hide whitespace changes
Inline
Side-by-side
ckanext/archiver/tasks.py
View file @
df343c60
...
...
@@ -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
))
...
...
tests/test_archiver.py
View file @
df343c60
...
...
@@ -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'
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment