Merge branch '219-missing-form'

This commit is contained in:
amercader 2016-02-04 12:50:58 +00:00
commit 86edc4209b
4 changed files with 73 additions and 3 deletions

View File

@ -4,6 +4,13 @@
{% block primary_content_inner %}
<div class="module-content">
{% block form %}{{ c.form | safe }}{% endblock %}
{% block form %}
{% if c.form %}
{# CKAN < 2.3 #}
{{ c.form | safe }}
{% else %}
{{- h.snippet(form_snippet, c=c, **form_vars) -}}
{% endif %}
{% endblock %}
</div>
{% endblock %}

View File

@ -13,7 +13,12 @@
{% block primary_content %}
<section class="module">
<div class="module-content">
{% block form %}{{ c.form | safe }}{% endblock %}
{% if c.form %}
{# CKAN < 2.3 #}
{{ c.form | safe }}
{% else %}
{{- h.snippet(form_snippet, c=c, **form_vars) -}}
{% endif %}
</div>
</section>
{% endblock %}

View File

@ -0,0 +1,58 @@
from ckan.lib.helpers import url_for
try:
from ckan.tests import helpers, factories
except ImportError:
from ckan.new_tests import helpers, factories
from ckanext.harvest.tests import factories as harvest_factories
try:
from ckan.tests.helpers import assert_in
except ImportError:
# for ckan 2.2
try:
from nose.tools import assert_in
except ImportError:
# Python 2.6 doesn't have it
def assert_in(a, b, msg=None):
assert a in b, msg or '%r was not in %r' % (a, b)
import ckanext.harvest.model as harvest_model
class TestController(helpers.FunctionalTestBase):
@classmethod
def setup_class(cls):
super(TestController, cls).setup_class()
harvest_model.setup()
sysadmin = factories.Sysadmin()
cls.extra_environ = {'REMOTE_USER': sysadmin['name'].encode('ascii')}
@classmethod
def teardown_class(cls):
super(TestController, cls).teardown_class()
helpers.reset_db()
def test_new_form_is_rendered(self):
url = url_for('harvest_new')
app = self._get_test_app()
response = app.get(url, extra_environ=self.extra_environ)
assert_in('<form id="source-new"', response.body)
def test_edit_form_is_rendered(self):
source = harvest_factories.HarvestSource()
url = url_for('harvest_edit', id=source['id'])
app = self._get_test_app()
response = app.get(url, extra_environ=self.extra_environ)
assert_in('<form id="source-new"', response.body)

View File

@ -1,5 +1,5 @@
[DEFAULT]
debug = true
debug = false
# Uncomment and replace with the address which should receive any error reports
#email_to = you@yourdomain.com
smtp_server = localhost