Skip to content

Commit

Permalink
Add PylonsTestCase to test session-based behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Oderbolz committed Jul 1, 2015
1 parent 013040b commit d8d0f79
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ckan/tests/legacy/lib/test_helpers.py
Expand Up @@ -38,12 +38,6 @@ def test_render_datetime_blank(self):
res = h.render_datetime(None)
assert_equal(res, '')

def test_render_datetime_with_utc_offset_from_session(self):
session['utc_timezone_offset'] = 120
session.save()
res = h.render_datetime(datetime.datetime(2008, 4, 13, 20, 40, 20, 123456), with_hours=True)
assert_equal(res, 'April 13, 2008, 22:40 (UTC+2)')

def test_datetime_to_date_str(self):
res = datetime.datetime(2008, 4, 13, 20, 40, 20, 123456).isoformat()
assert_equal(res, '2008-04-13T20:40:20.123456')
Expand Down Expand Up @@ -186,3 +180,11 @@ def test_get_pkg_dict_extra(self):
assert_equal(h.get_pkg_dict_extra(pkg_dict, 'extra_not_found'), None)

assert_equal(h.get_pkg_dict_extra(pkg_dict, 'extra_not_found', 'default_value'), 'default_value')


class TestHelpersWithPylons(pylons_controller.PylonsTestCase):
def test_render_datetime_with_utc_offset_from_session(self):
session['utc_timezone_offset'] = 120
session.save()
res = h.render_datetime(datetime.datetime(2008, 4, 13, 20, 40, 20, 123456), with_hours=True)
assert_equal(res, 'April 13, 2008, 22:40 (UTC+2)')

0 comments on commit d8d0f79

Please sign in to comment.