Skip to content

Commit

Permalink
[#262] Convert tests that used from lib.helpers import ...
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Jan 11, 2013
1 parent 691e670 commit c46317d
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion ckan/tests/functional/api/base.py
Expand Up @@ -10,11 +10,11 @@
import webhelpers.util
from nose.tools import assert_equal
from paste.fixture import TestRequest
from webhelpers.html import url_escape

from ckan.tests import *
import ckan.model as model
from ckan.lib.create_test_data import CreateTestData
from ckan.lib.helpers import json, url_escape
from ckan.tests import TestController as ControllerTestCase

ACCESS_DENIED = [403]
Expand Down
2 changes: 1 addition & 1 deletion ckan/tests/functional/api/model/test_vocabulary.py
@@ -1,7 +1,7 @@
import ckan
from pylons.test import pylonsapp
import paste.fixture
from ckan.lib.helpers import json
from ckan.common import json
import ckan.lib.dictization.model_dictize as model_dictize
import sqlalchemy
from nose.tools import raises, assert_raises
Expand Down
2 changes: 1 addition & 1 deletion ckan/tests/functional/api/test_activity.py
Expand Up @@ -14,7 +14,7 @@

import pylons.test
import paste.fixture
from ckan.lib.helpers import json
from ckan.common import json


##<<<<<<< HEAD
Expand Down
2 changes: 1 addition & 1 deletion ckan/tests/functional/api/test_dashboard.py
Expand Up @@ -6,7 +6,7 @@
'''
import ckan
from ckan.lib.helpers import json
from ckan.common import json
import paste
import pylons.test

Expand Down
2 changes: 1 addition & 1 deletion ckan/tests/functional/api/test_util.py
Expand Up @@ -4,7 +4,7 @@
from ckan.lib.create_test_data import CreateTestData
from ckan.tests import TestController as ControllerTestCase
from ckan.tests import url_for
from ckan.lib.helpers import json
from ckan.common import json

class TestUtil(ControllerTestCase):
@classmethod
Expand Down
10 changes: 5 additions & 5 deletions ckan/tests/functional/test_datastore.py
Expand Up @@ -8,7 +8,7 @@

from ckan.tests import TestController, CreateTestData
import ckan.model as model
from ckan.lib.helpers import url_for
import ckan.lib.helpers as h


ELASTIC_SEARCH_HOST = config.get('elastic_search_host', '0.0.0.0:9200')
Expand Down Expand Up @@ -153,10 +153,10 @@ def test_basic(self):

assert not dataset.resources[0].webstore_url

offset_wrong_read = url_for('datastore_read', id='wrong_resource_id')
offset_wrong_write = url_for('datastore_write', id='wrong_resource_id')
offset_read = url_for('datastore_read', id=resource_id)
offset_write = url_for('datastore_write', id=resource_id)
offset_wrong_read = h.url_for('datastore_read', id='wrong_resource_id')
offset_wrong_write = h.url_for('datastore_write', id='wrong_resource_id')
offset_read = h.url_for('datastore_read', id=resource_id)
offset_write = h.url_for('datastore_write', id=resource_id)

# Resource not found
res = mock_server.get(offset_wrong_read, ckan_status=404)
Expand Down
10 changes: 5 additions & 5 deletions ckan/tests/functional/test_search.py
Expand Up @@ -10,7 +10,7 @@
from base import FunctionalTestCase
from ckan import model
import ckan.lib.search as search
from ckan.lib.helpers import url_for
import ckan.lib.helpers as h

class TestSearch(FunctionalTestCase):
# 'penguin' is in all test search packages
Expand Down Expand Up @@ -84,7 +84,7 @@ def teardown_class(cls):

@search_related
def test_search(self):
offset = url_for(controller='package', action='search')
offset = h.url_for(controller='package', action='search')
print offset
res = self.app.get(offset)
assert 'Search - ' in res
Expand All @@ -97,7 +97,7 @@ def test_search(self):

@search_related
def test_search_foreign_chars(self):
offset = url_for(controller='package', action='search')
offset = h.url_for(controller='package', action='search')
res = self.app.get(offset)
assert 'Search - ' in res
self._check_search_results(res, u'th\xfcmb', ['<strong>1</strong>'])
Expand All @@ -106,7 +106,7 @@ def test_search_foreign_chars(self):
@search_related
def test_search_escape_chars(self):
payload = '?q=fjdkf%2B%C2%B4gfhgfkgf%7Bg%C2%B4pk&search=Search+Packages+%C2%BB'
offset = url_for(controller='package', action='search') + payload
offset = h.url_for(controller='package', action='search') + payload
results_page = self.app.get(offset)
assert 'Search - ' in results_page, results_page
results_page = self.main_div(results_page)
Expand Down Expand Up @@ -154,7 +154,7 @@ def teardown_class(self):

@search_related
def test_search(self):
offset = url_for(controller='package', action='search')
offset = h.url_for(controller='package', action='search')
res = self.app.get(offset)
assert 'Search - ' in res
form = res.forms['dataset-search']
Expand Down
2 changes: 1 addition & 1 deletion ckan/tests/lib/test_cli.py
Expand Up @@ -6,7 +6,7 @@
from ckan import model
from ckan.lib.cli import ManageDb,SearchIndexCommand
from ckan.lib.create_test_data import CreateTestData
from ckan.lib.helpers import json
from ckan.common import json

from ckan.lib.search import index_for,query_for

Expand Down
2 changes: 1 addition & 1 deletion ckan/tests/misc/test_sync.py
Expand Up @@ -8,7 +8,7 @@
import ckan.model as model
from ckan.tests import *
from ckan.lib.create_test_data import CreateTestData
from ckan.lib.helpers import json
from ckan.common import json

instance_dir = config['here']

Expand Down
2 changes: 1 addition & 1 deletion ckan/tests/test_dumper.py
Expand Up @@ -6,7 +6,7 @@
from ckan.tests import *
import ckan.model as model
import ckan.lib.dumper as dumper
from ckan.lib.helpers import json
from ckan.common import json
from ckan.lib.dumper import Dumper
simple_dumper = dumper.SimpleDumper()

Expand Down

0 comments on commit c46317d

Please sign in to comment.