Skip to content
Snippets Groups Projects
Commit d4bfc397 authored by anonymous's avatar anonymous
Browse files

check upload formats only on slave

parent 6960918b
No related branches found
No related tags found
No related merge requests found
......@@ -91,7 +91,6 @@ class TestEnv:
def test_config_set(self):
checkConfigForDuplicates()
checkConfig('ckanext.odsh.upload_formats', minLength=2)
checkConfig('ckanext.dcat.rdf.profiles',
'odsheuro_dcat_ap odshdcatap_de')
checkConfig('ckan.harvest.mq.type', 'redis')
......@@ -112,6 +111,7 @@ class TestEnv:
checkConfigDir('ckan.storage_path')
if isSlave():
checkConfig('ckanext.odsh.upload_formats', minLength=2)
checkConfig('ckanext.spatial.search_backend', 'solr-spatial-field')
checkConfig('ckanext.spatial.common_map.type', 'wms')
checkConfig('ckanext.spatial.common_map.wms.url',
......@@ -132,7 +132,7 @@ class TestEnv:
assert p in value, 'missing plugin:' + p
if isMaster():
for p in ['odsh_icap', 'odsh_dcat_harvest', 'odsh', 'odsh_harvest']:
for p in ['odsh_icap', 'odsh_dcat_harvest', 'odsh_harvest']:
assert p in value, 'missing plugin:' + p
# pdb.set_trace()
......
from ckan.common import config
import ckan.model as model
import pdb
import json
import ckanext.odsh.profiles as profiles
import urllib2
import ckan.tests.helpers as helpers
from ckan.common import config
import ckan.config.middleware
from routes import url_for
webtest_submit = helpers.webtest_submit
# run with nosetests --ckan --nologcapture --with-pylons=<config to test> ckanext/odsh/tests/test_routes.py
def _get_test_app():
app = ckan.config.middleware.make_app(config['global_conf'], **config)
app = helpers.CKANTestApp(app)
return app
class TestRoutes:
def test_upload_empty_form_fails(self):
# arrange
self._login()
form = self._get_package_new_form()
# # act
response = self._submit_form(form)
# # assert
# response.mustcontain('Title: Missing value')
# response.mustcontain('Description: Missing value')
# response.mustcontain('temporal_start: empty')
def _get_package_new_form(self):
# self.env = {'REMOTE_USER': 'ckanuser'}
response = self.app.get(
url=url_for(controller='package', action='new')
# extra_environ=self.env,
)
return response.forms['dataset-edit']
def _login(self):
app = _get_test_app()
response = app.get('/user/login')
login_form = response.forms[0]
login_form['login'] = 'ckanuser'
login_form['password'] = 'pass'
submit_response = login_form.submit('save')
final_response = helpers.webtest_maybe_follow(submit_response)
# the response is the user dashboard, right?
# final_response.mustcontain('<a href="/dashboard">Dashboard</a>',
# '<span class="username">sysadmin</span>')
self.app = app
def _submit_form(self, form):
return webtest_submit(form, 'save', status=200)#, extra_environ=self.env)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment