Skip to content

Commit

Permalink
allow creating none default package types for testing purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Feb 27, 2012
1 parent 3fab4a1 commit a264922
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
6 changes: 3 additions & 3 deletions ckan/lib/create_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def create_groups(cls, group_dicts, admin_user_name=None, auth_profile=""):
model.repo.commit_and_remove()

@classmethod
def create(cls, auth_profile=""):
def create(cls, auth_profile="", package_type=None):
import ckan.model as model
model.Session.remove()
rev = model.repo.new_revision()
Expand All @@ -323,7 +323,7 @@ def create(cls, auth_profile=""):
publisher_group = model.Group(name=u"publisher_group", type="publisher")

cls.pkg_names = [u'annakarenina', u'warandpeace']
pkg1 = model.Package(name=cls.pkg_names[0])
pkg1 = model.Package(name=cls.pkg_names[0], type=package_type)
if auth_profile == "publisher":
pkg1.group = publisher_group
model.Session.add(pkg1)
Expand Down Expand Up @@ -375,7 +375,7 @@ def create(cls, auth_profile=""):
<http://ckan.net/>
'''
pkg2 = model.Package(name=cls.pkg_names[1])
pkg2 = model.Package(name=cls.pkg_names[1], type=package_type)
tag1 = model.Tag(name=u'russian')
tag2 = model.Tag(name=u'tolstoy')

Expand Down
10 changes: 1 addition & 9 deletions ckan/tests/functional/test_tag_vocab.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def value__get(self):
class TestWUI(WsgiAppCase):
@classmethod
def setup_class(cls):
CreateTestData.create()
CreateTestData.create(package_type='mock_vocab_tags_plugin')
cls.sysadmin_user = model.User.get('testsysadmin')
cls.dset = model.Package.get('warandpeace')
cls.tag1_name = 'vocab-tag-1'
Expand All @@ -147,12 +147,6 @@ def setup_class(cls):
plugins.load(cls.plugin)
cls.plugin.active = True

# this is a hack so that the plugin is properly registered with
# the package controller class.
from ckan.controllers import package as package_controller
cls.old_default_controller = package_controller._default_controller_behaviour
package_controller._default_controller_behaviour = cls.plugin

# use our custom select class for this test suite
cls.old_select = paste.fixture.Field.classes['select']
paste.fixture.Field.classes['select'] = Select
Expand Down Expand Up @@ -180,8 +174,6 @@ def setup_class(cls):
def teardown_class(cls):
plugins.unload(cls.plugin)
cls.plugin.active = False
from ckan.controllers import package as package_controller
package_controller._default_controller_behaviour = cls.old_default_controller
paste.fixture.Field.classes['select'] = cls.old_select
model.repo.rebuild_db()

Expand Down

0 comments on commit a264922

Please sign in to comment.