Skip to content

Commit

Permalink
[#981] Fix test to use ckan app by @tobes
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Aug 1, 2013
1 parent cd23a46 commit 955e422
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 1 addition & 2 deletions ckanext/datastore/logic/action.py
Expand Up @@ -9,7 +9,6 @@
import ckan.lib.navl.dictization_functions
import ckan.logic as logic
import ckan.plugins as p
import ckan.lib.helpers as h
import ckanext.datastore.db as db
import ckanext.datastore.logic.schema as dsschema

Expand Down Expand Up @@ -104,7 +103,7 @@ def datastore_create(context, data_dict):
# create empty resource
# have to set the url here because we need the resource id
else:
res['url'] = h.url_for(
res['url'] = p.toolkit.url_for(
controller='ckanext.datastore.controller:DatastoreController',
action='dump', resource_id=res['id'])
p.toolkit.get_action('resource_update')(context, res)
Expand Down
8 changes: 7 additions & 1 deletion ckanext/datastore/tests/test_create.py
Expand Up @@ -5,12 +5,15 @@
from nose.tools import assert_equal

import pylons
from pylons import config
import sqlalchemy.orm as orm
import paste.fixture

import ckan.plugins as p
import ckan.lib.create_test_data as ctd
import ckan.model as model
import ckan.tests as tests
from ckan.config.middleware import make_app

import ckanext.datastore.db as db
from ckanext.datastore.tests.helpers import rebuild_all_dbs
Expand All @@ -28,6 +31,9 @@ class TestDatastoreCreate(tests.WsgiAppCase):

@classmethod
def setup_class(cls):

wsgiapp = make_app(config['global_conf'], **config)
cls.app = paste.fixture.TestApp(wsgiapp)
if not tests.is_datastore_supported():
raise nose.SkipTest("Datastore not supported")
p.load('datastore')
Expand Down Expand Up @@ -546,7 +552,7 @@ def test_create_ckan_resource_in_package(self):
res = tests.call_action_api(
self.app, 'resource_show', id=res_dict['result']['resource_id'])
# disabled until #547 fixes problems with the plugins in tests
#assert res['url'] == '/datastore/dump/' + res['id'], res
assert res['url'] == '/datastore/dump/' + res['id'], res

@httpretty.activate
def test_providing_res_with_url_calls_datapusher_correctly(self):
Expand Down

0 comments on commit 955e422

Please sign in to comment.