Skip to content

Commit

Permalink
[#1797,webstore][s]: read actually looks up resource.
Browse files Browse the repository at this point in the history
  • Loading branch information
rufuspollock committed Feb 18, 2012
1 parent 91c0744 commit 3c7238b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion ckan/controllers/webstore.py
@@ -1,6 +1,10 @@
from ckan.lib.base import BaseController
import ckan.model as model

class WebstoreController(BaseController):
def data(self, id):
return ''
resource = model.Session.query(model.Resource).get(id)
if not resource:
abort(404)
return resource.id

10 changes: 7 additions & 3 deletions ckan/tests/functional/test_webstore.py
@@ -1,3 +1,5 @@
from nose.tools import assert_equal

from ckan.tests import *
from ckan.tests.pylons_controller import PylonsTestCase
import ckan.model as model
Expand All @@ -13,9 +15,11 @@ def setup_class(cls):
def teardown_class(self):
model.repo.rebuild_db()

def test_01(self):
resource_id = '123'
def test_read(self):
dataset = model.Package.by_name(CreateTestData.pkg_names[0])
resource_id = dataset.resources[0].id
offset = url_for('webstore', id=resource_id)
print offset
res = self.app.get(offset)
assert_equal(res.status, 200)
assert_equal(res.body, resource_id)

0 comments on commit 3c7238b

Please sign in to comment.