Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tino097 committed Oct 18, 2017
1 parent e1df6dc commit 20260cc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
15 changes: 7 additions & 8 deletions ckan/tests/controllers/test_feed.py
Expand Up @@ -45,7 +45,7 @@ def test_general_atom_feed_works(self):
offset = url_for(u'feeds.general')
res = app.get(offset)

assert u'<title type="text">{0}</title>'.format(
assert u'<title>{0}</title>'.format(
dataset['title']) in res.body

def test_group_atom_feed_works(self):
Expand All @@ -56,7 +56,7 @@ def test_group_atom_feed_works(self):
offset = url_for(u'feeds.group', id=group['name'])
res = app.get(offset)

assert u'<title type="text">{0}</title>'.format(
assert u'<title>{0}</title>'.format(
dataset['title']) in res.body

def test_organization_atom_feed_works(self):
Expand All @@ -67,7 +67,7 @@ def test_organization_atom_feed_works(self):
offset = url_for(u'feeds.organization', id=group['name'])
res = app.get(offset)

assert u'<title type="text">{0}</title>'.format(
assert u'<title>{0}</title>'.format(
dataset['title']) in res.body

def test_custom_atom_feed_works(self):
Expand All @@ -89,10 +89,10 @@ def test_custom_atom_feed_works(self):
app = self._get_test_app()
res = app.get(offset, params=params)

assert u'<title type="text">{0}</title>'.format(
assert u'<title>{0}</title>'.format(
dataset1['title']) in res.body

assert u'<title type="text">{0}</title>'.format(
assert u'<title">{0}</title>'.format(
dataset2['title']) not in res.body


Expand All @@ -111,9 +111,8 @@ def teardown_class(cls):

def test_custom_class_used(self):

import pdb; pdb.set_trace()
app = self._get_test_app()
offset = url_for(u'feeds.custom')
offset = url_for(u'feeds.general')
app = self._get_test_app()
res = app.get(offset)

Expand All @@ -132,7 +131,7 @@ def test_additional_fields_added(self):
factories.Dataset(extras=extras)

app = self._get_test_app()
offset = url_for(controller="feeds", action='general')
offset = url_for(u'feeds.general')
app = self._get_test_app()
res = app.get(offset)

Expand Down
12 changes: 6 additions & 6 deletions ckan/views/feed.py
Expand Up @@ -3,7 +3,7 @@
import logging
import urlparse

from flask import Blueprint
from flask import Blueprint, make_response
import webhelpers.feedgenerator
from ckan.common import _, config, g, request, response
import ckan.lib.helpers as h
Expand Down Expand Up @@ -125,7 +125,9 @@ def output_feed(results, feed_title, feed_description, feed_link, feed_url,
**additional_fields)

# response.content_type = feed.mime_type
return feed.writeString('utf-8')
resp = make_response(feed.writeString('utf-8'), 200)
resp.headers['Content-Type'] = 'text/xml'
return resp


def group(id):
Expand Down Expand Up @@ -332,13 +334,11 @@ def custom():

alternate_url = _alternate_url(request.params)

site_title = config.get(u'ckan.site_title', u'CKAN')

return output_feed(
results,
feed_title=u'%s - Custom query' % site_title,
feed_title=u'%s - Custom query' % SITE_TITLE,
feed_description=u'Recently created or updated'
' datasets on %s. Custom query: \'%s\'' % (site_title, q),
' datasets on %s. Custom query: \'%s\'' % (SITE_TITLE, q),
feed_link=alternate_url,
feed_guid=_create_atom_id(atom_url),
feed_url=feed_url,
Expand Down

0 comments on commit 20260cc

Please sign in to comment.